diff --git a/Neos.Neos/Classes/FrontendRouting/EventSourcedFrontendNodeRoutePartHandler.php b/Neos.Neos/Classes/FrontendRouting/EventSourcedFrontendNodeRoutePartHandler.php index 56f414cbf53..d6b0257d1bd 100644 --- a/Neos.Neos/Classes/FrontendRouting/EventSourcedFrontendNodeRoutePartHandler.php +++ b/Neos.Neos/Classes/FrontendRouting/EventSourcedFrontendNodeRoutePartHandler.php @@ -16,6 +16,7 @@ use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; +use Neos\ContentRepository\Core\SharedModel\Node\NodeIdentity; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Mvc\Routing\RoutingMiddleware; @@ -44,14 +45,14 @@ /** * A route part handler for finding nodes in the website's frontend. Like every RoutePartHandler, * this handles both directions: - * - from URL to NodeAddress (via {@see EventSourcedFrontendNodeRoutePartHandler::matchWithParameters}) - * - from NodeAddress to URL (via {@see EventSourcedFrontendNodeRoutePartHandler::resolveWithParameters}) + * - from URL to NodeIdentity (via {@see EventSourcedFrontendNodeRoutePartHandler::matchWithParameters}) + * - from NodeIdentity to URL (via {@see EventSourcedFrontendNodeRoutePartHandler::resolveWithParameters}) * * For performance reasons, this uses a special projection {@see DocumentUriPathFinder}, and * does NOT use the graph projection in any way. * * - * ## Match Direction (URL to NodeAddress) + * ## Match Direction (URL to NodeIdentity) * * This is usually simply triggered ONCE per request, before the controller starts working. * The RoutePartHandler is invoked from {@see RoutingMiddleware} (which handles the routing). @@ -62,7 +63,7 @@ * (*) = Extension Point ┌───────────────────────────────────────────────┐ * ┌──────────────┐ │ EventSourcedFrontendNodeRoutePartHandler │ * │SiteDetection │ │ ┌─────────────────────┐ │ - * │Middleware (*)│────────────────────▶│ │DimensionResolver (*)│─────▶ Finding the ─┼─▶NodeAddress + * │Middleware (*)│────────────────────▶│ │DimensionResolver (*)│─────▶ Finding the ─┼─▶NodeIdentity * └──────────────┘ current site │ └─────────────────────┘ NodeId │ * └───────────────────────────────────────────────┘ * current Content current @@ -110,7 +111,7 @@ * ### Result of the Routing * * The **result** of the {@see EventSourcedFrontendNodeRoutePartHandler::matchWithParameters} call is a - * {@see NodeAddress} (wrapped in a {@see MatchResult}); so to build the NodeAddress, we need: + * {@see NodeIdentity} (wrapped in a {@see MatchResult}); so to build the NodeIdentity, we need: * - the {@see WorkspaceName} (which is always **live** in our case) * - the {@see ContentStreamId} of the Live workspace * - The {@see DimensionSpacePoint} we want to see the page in (i.e. in language=de) @@ -119,13 +120,13 @@ * - resolved by {@see EventSourcedFrontendNodeRoutePartHandler} * * - * ## Resolve Direction (NodeAddress to URL) + * ## Resolve Direction (NodeIdentity to URL) * * ``` * ┌────────────────────────────────────────────────────────────────────────┐ * │ EventSourcedFrontendNodeRoutePartHandler │ * │ ┌─────────────────────┐ ┌─────────────────────┐ │ - * NodeAddress────┼▶ Finding the ────▶│ CrossSiteLinker (*) │─────▶│DimensionResolver (*)│─┼──▶ URL + * NodeIdentity───┼▶ Finding the ────▶│ CrossSiteLinker (*) │─────▶│DimensionResolver (*)│─┼──▶ URL * │ URL └─────────────────────┘ └─────────────────────┘ │ * └────────────────────────────────────────────────────────────────────────┘ * ``` @@ -236,12 +237,13 @@ private function matchUriPath( $uriPath, $dimensionSpacePoint->hash ); - $nodeAddress = NodeAddressFactory::create($contentRepository)->createFromContentStreamIdAndDimensionSpacePointAndNodeAggregateId( - $documentUriPathFinder->getLiveContentStreamId(), + $nodeIdentity = NodeIdentity::create( + $contentRepository->id, + WorkspaceName::forLive(), $dimensionSpacePoint, $nodeInfo->getNodeAggregateId(), ); - return new MatchResult($nodeAddress->serializeForUri(), $nodeInfo->getRouteTags()); + return new MatchResult($nodeIdentity->toJson(), $nodeInfo->getRouteTags()); } /** @@ -256,14 +258,13 @@ public function resolveWithParameters(array &$routeValues, RouteParameters $para } $currentRequestSiteDetectionResult = SiteDetectionResult::fromRouteParameters($parameters); - $nodeAddress = $routeValues[$this->name]; - // TODO: for cross-CR links: NodeAddressInContentRepository as a new value object - if (!$nodeAddress instanceof NodeAddress) { + $nodeIdentity = $routeValues[$this->name]; + if (!$nodeIdentity instanceof NodeIdentity) { return false; } try { - $resolveResult = $this->resolveNodeAddress($nodeAddress, $currentRequestSiteDetectionResult); + $resolveResult = $this->resolveNodeIdentity($nodeIdentity, $currentRequestSiteDetectionResult); } catch (NodeNotFoundException | InvalidShortcutException $exception) { // TODO log exception return false; @@ -274,30 +275,26 @@ public function resolveWithParameters(array &$routeValues, RouteParameters $para } /** - * Resolves a node address for uri building. + * Resolves a node identity for uri building. * * NOTE: The resolving of nodes is also done for disabled/hidden nodes. * To disallow showing a node actually disabled/hidden itself has to be ensured in matching a request path, * not in building one. * - * @param NodeAddress $nodeAddress - * @param SiteDetectionResult $currentRequestSiteDetectionResult - * @return ResolveResult * @throws InvalidShortcutException * @throws NodeNotFoundException */ - private function resolveNodeAddress( - NodeAddress $nodeAddress, + private function resolveNodeIdentity( + NodeIdentity $nodeIdentity, SiteDetectionResult $currentRequestSiteDetectionResult ): ResolveResult { - // TODO: SOMEHOW FIND OTHER CONTENT REPOSITORY HERE FOR CROSS-CR LINKS!! $contentRepository = $this->contentRepositoryRegistry->get( - $currentRequestSiteDetectionResult->contentRepositoryId + $nodeIdentity->contentRepositoryId ); $documentUriPathFinder = $contentRepository->projectionState(DocumentUriPathFinder::class); $nodeInfo = $documentUriPathFinder->getByIdAndDimensionSpacePointHash( - $nodeAddress->nodeAggregateId, - $nodeAddress->dimensionSpacePoint->hash + $nodeIdentity->nodeAggregateId, + $nodeIdentity->dimensionSpacePoint->hash ); if ($nodeInfo->isShortcut()) { @@ -322,7 +319,7 @@ private function resolveNodeAddress( } $uriConstraints = $this->delegatingResolver->fromDimensionSpacePointToUriConstraints( - $nodeAddress->dimensionSpacePoint, + $nodeIdentity->dimensionSpacePoint, $nodeInfo, $targetSite, $uriConstraints diff --git a/Neos.Neos/Classes/FrontendRouting/FrontendNodeRoutePartHandlerInterface.php b/Neos.Neos/Classes/FrontendRouting/FrontendNodeRoutePartHandlerInterface.php index 40766ae9654..feb754ba03e 100644 --- a/Neos.Neos/Classes/FrontendRouting/FrontendNodeRoutePartHandlerInterface.php +++ b/Neos.Neos/Classes/FrontendRouting/FrontendNodeRoutePartHandlerInterface.php @@ -20,8 +20,6 @@ * Marker interface which can be used to replace the currently used FrontendNodeRoutePartHandler, * to e.g. use the one with localization support. * - * TODO CORE MIGRATION - * * **See {@see EventSourcedFrontendNodeRoutePartHandler} documentation for a * detailed explanation of the Frontend Routing process.** */