From b90b043264a1aa212178f710cc657006b2c29e12 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 11 May 2024 20:38:11 +0200 Subject: [PATCH] WIP: Fixes --- .../FrontendRouting/NodeShortcutResolver.php | 20 +++++++++---------- Neos.Neos/Classes/Fusion/Cache/CacheTag.php | 2 +- .../Fusion/ConvertUrisImplementation.php | 4 ++-- .../Classes/Fusion/NodeUriImplementation.php | 1 + 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Neos.Neos/Classes/FrontendRouting/NodeShortcutResolver.php b/Neos.Neos/Classes/FrontendRouting/NodeShortcutResolver.php index d3e5786c96..2f3d563062 100644 --- a/Neos.Neos/Classes/FrontendRouting/NodeShortcutResolver.php +++ b/Neos.Neos/Classes/FrontendRouting/NodeShortcutResolver.php @@ -17,7 +17,7 @@ use GuzzleHttp\Psr7\Uri; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; -use Neos\ContentRepository\Core\SharedModel\Node\NodeIdentity; +use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Annotations as Flow; use Neos\Flow\ResourceManagement\ResourceManager; @@ -50,31 +50,31 @@ public function __construct( * Note: The ContentStreamId is not required for this service, * because it is only covering the live workspace * - * @return NodeIdentity|UriInterface NodeIdentity is returned if we want to link to another node + * @return NodeAddress|UriInterface NodeIdentity is returned if we want to link to another node * (i.e. node is NOT a shortcut node; or target is a node); * or UriInterface for links to fixed URLs (Asset URLs or external URLs) * @throws \Neos\Neos\FrontendRouting\Exception\InvalidShortcutException * @throws NodeNotFoundException */ - public function resolveShortcutTarget(NodeIdentity $nodeIdentity) + public function resolveShortcutTarget(NodeAddress $nodeAddress) { - if (!$nodeIdentity->workspaceName->isLive()) { - throw new \RuntimeException(sprintf('Cannot resolve shortcut target for node-address %s in workspace %s because the DocumentUriPathProjection only handles the live workspace.', $nodeIdentity->nodeAggregateId->value, $nodeIdentity->workspaceName->value), 1707208650); + if (!$nodeAddress->workspaceName->isLive()) { + throw new \RuntimeException(sprintf('Cannot resolve shortcut target for node-address %s in workspace %s because the DocumentUriPathProjection only handles the live workspace.', $nodeAddress->aggregateId->value, $nodeAddress->workspaceName->value), 1707208650); } - $contentRepository = $this->contentRepositoryRegistry->get($nodeIdentity->contentRepositoryId); + $contentRepository = $this->contentRepositoryRegistry->get($nodeAddress->contentRepositoryId); $documentUriPathFinder = $contentRepository->projectionState(DocumentUriPathFinder::class); $documentNodeInfo = $documentUriPathFinder->getByIdAndDimensionSpacePointHash( - $nodeIdentity->nodeAggregateId, - $nodeIdentity->dimensionSpacePoint->hash + $nodeAddress->aggregateId, + $nodeAddress->dimensionSpacePoint->hash ); $resolvedTarget = $this->resolveNode($documentNodeInfo, $contentRepository); if ($resolvedTarget instanceof UriInterface) { return $resolvedTarget; } if ($resolvedTarget === $documentNodeInfo) { - return $nodeIdentity; + return $nodeAddress; } - return $nodeIdentity->withNodeAggregateId($documentNodeInfo->getNodeAggregateId()); + return $nodeAddress->withAggregateId($documentNodeInfo->getNodeAggregateId()); } /** diff --git a/Neos.Neos/Classes/Fusion/Cache/CacheTag.php b/Neos.Neos/Classes/Fusion/Cache/CacheTag.php index 202abcc682..ca128f659f 100644 --- a/Neos.Neos/Classes/Fusion/Cache/CacheTag.php +++ b/Neos.Neos/Classes/Fusion/Cache/CacheTag.php @@ -108,7 +108,7 @@ final public static function forNodeTypeName( final public static function forDynamicNodeAggregate( ContentRepositoryId $contentRepositoryId, - WorkspaceName $workspaceName, + WorkspaceName|ContentStreamId $workspaceName, NodeAggregateId $nodeAggregateId, ): self { return new self( diff --git a/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php b/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php index 25bd4cfcd0..c1c4df2b11 100644 --- a/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php +++ b/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php @@ -147,7 +147,7 @@ public function evaluate() $unresolvedUris = []; $absolute = $this->fusionValue('absolute'); - $processedContent = preg_replace_callback(self::PATTERN_SUPPORTED_URIS, function (array $matches) use ($contentRepository, $nodeAddress, &$unresolvedUris, $absolute) { + $processedContent = preg_replace_callback(self::PATTERN_SUPPORTED_URIS, function (array $matches) use ($nodeAddress, &$unresolvedUris, $absolute) { $resolvedUri = null; switch ($matches[1]) { case 'node': @@ -174,7 +174,7 @@ public function evaluate() $this->systemLogger->warning(sprintf('Could not resolve "%s" to a node uri.', $matches[0]), LogEnvironment::fromMethodName(__METHOD__)); } $this->runtime->addCacheTag( - CacheTag::forDynamicNodeAggregate($nodeAddress->contentRepositoryId, $nodeAddress->workspaceName, $nodeAddress->nodeAggregateId)->value + CacheTag::forDynamicNodeAggregate($nodeAddress->contentRepositoryId, $nodeAddress->workspaceName, $nodeAddress->aggregateId)->value ); break; case 'asset': diff --git a/Neos.Neos/Classes/Fusion/NodeUriImplementation.php b/Neos.Neos/Classes/Fusion/NodeUriImplementation.php index 7887b9c1f8..15f2366c31 100644 --- a/Neos.Neos/Classes/Fusion/NodeUriImplementation.php +++ b/Neos.Neos/Classes/Fusion/NodeUriImplementation.php @@ -14,6 +14,7 @@ namespace Neos\Neos\Fusion; +use GuzzleHttp\Psr7\Uri; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Annotations as Flow;