From 97c9445660723dd9ebca6d524c76d4ce15afc57a Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 16 Jun 2024 10:34:13 +0200 Subject: [PATCH 1/5] TASK: Adjust controllers to use legacy node address notation explicitly instead of property mapping --- .../Controller/Backend/ContentController.php | 5 +-- .../Controller/Service/NodesController.php | 5 +-- .../Controller/DataSourceController.php | 31 +++++++++++++++++-- .../Controller/WorkspaceController.php | 25 +++++++++------ phpstan.neon.dist | 1 + 5 files changed, 50 insertions(+), 17 deletions(-) diff --git a/Neos.Neos/Classes/Controller/Backend/ContentController.php b/Neos.Neos/Classes/Controller/Backend/ContentController.php index dd474086c97..699acb726cc 100644 --- a/Neos.Neos/Classes/Controller/Backend/ContentController.php +++ b/Neos.Neos/Classes/Controller/Backend/ContentController.php @@ -150,14 +150,15 @@ public function uploadAssetAction(Asset $asset, string $metadata, string $node, $contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest()) ->contentRepositoryId; $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); - $nodeAddress = NodeAddressFactory::create($contentRepository)->createFromUriString($nodeAddressString); + // todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress + $nodeAddress = NodeAddressFactory::create($contentRepository)->createCoreNodeAddressFromLegacyUriString($nodeAddressString); $node = $contentRepository->getContentGraph($nodeAddress->workspaceName) ->getSubgraph( $nodeAddress->dimensionSpacePoint, VisibilityConstraints::withoutRestrictions() ) - ->findNodeById($nodeAddress->nodeAggregateId); + ->findNodeById($nodeAddress->aggregateId); $this->response->setContentType('application/json'); diff --git a/Neos.Neos/Classes/Controller/Service/NodesController.php b/Neos.Neos/Classes/Controller/Service/NodesController.php index 244dafebdfb..5d35b1bb1ff 100644 --- a/Neos.Neos/Classes/Controller/Service/NodesController.php +++ b/Neos.Neos/Classes/Controller/Service/NodesController.php @@ -121,8 +121,9 @@ public function indexAction( : null; $nodeAddress = null; if (!$nodePath) { + // todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress $nodeAddress = $contextNode - ? NodeAddressFactory::create($contentRepository)->createFromUriString($contextNode) + ? NodeAddressFactory::create($contentRepository)->createCoreNodeAddressFromLegacyUriString($contextNode) : null; } @@ -141,7 +142,7 @@ public function indexAction( if ($nodeIds === [] && (!is_null($nodeAddress) || !is_null($nodePath))) { if (!is_null($nodeAddress)) { - $entryNode = $subgraph->findNodeById($nodeAddress->nodeAggregateId); + $entryNode = $subgraph->findNodeById($nodeAddress->aggregateId); } else { /** @var AbsoluteNodePath $nodePath */ $entryNode = $subgraph->findNodeByAbsolutePath($nodePath); diff --git a/Neos.Neos/Classes/Service/Controller/DataSourceController.php b/Neos.Neos/Classes/Service/Controller/DataSourceController.php index ec4245a5d18..d77001d437a 100644 --- a/Neos.Neos/Classes/Service/Controller/DataSourceController.php +++ b/Neos.Neos/Classes/Service/Controller/DataSourceController.php @@ -15,9 +15,14 @@ namespace Neos\Neos\Service\Controller; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; +use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; +use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; +use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Annotations as Flow; use Neos\Flow\Mvc\View\JsonView; use Neos\Flow\ObjectManagement\ObjectManagerInterface; +use Neos\Neos\FrontendRouting\NodeAddressFactory; +use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult; use Neos\Utility\ObjectAccess; use Neos\Flow\Reflection\ReflectionService; use Neos\Neos\Exception as NeosException; @@ -30,6 +35,9 @@ */ class DataSourceController extends AbstractServiceController { + #[Flow\Inject] + protected ContentRepositoryRegistry $contentRepositoryRegistry; + /** * @var array */ @@ -39,10 +47,9 @@ class DataSourceController extends AbstractServiceController /** * @param string $dataSourceIdentifier - * @param Node $node * @throws NeosException */ - public function indexAction($dataSourceIdentifier, Node $node = null): void + public function indexAction($dataSourceIdentifier, string $node = null): void { $dataSources = static::getDataSources($this->objectManager); @@ -63,11 +70,29 @@ public function indexAction($dataSourceIdentifier, Node $node = null): void unset($arguments['dataSourceIdentifier']); unset($arguments['node']); - $values = $dataSource->getData($node, $arguments); + $values = $dataSource->getData($this->deserializeNodeFromLegacyAddress($node), $arguments); $this->view->assign('value', $values); } + private function deserializeNodeFromLegacyAddress(?string $stringFormattedNodeAddress): ?Node + { + if (!$stringFormattedNodeAddress) { + return null; + } + + $contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest()) + ->contentRepositoryId; + $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); + // todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress + $nodeAddress = NodeAddressFactory::create($contentRepository)->createCoreNodeAddressFromLegacyUriString($stringFormattedNodeAddress); + + return $contentRepository->getContentGraph($nodeAddress->workspaceName)->getSubgraph( + $nodeAddress->dimensionSpacePoint, + VisibilityConstraints::withoutRestrictions() + )->findNodeById($nodeAddress->aggregateId); + } + /** * Get available data source implementations * diff --git a/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php b/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php index a76443dd849..2ba5e17b7ec 100644 --- a/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php +++ b/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php @@ -447,11 +447,13 @@ public function deleteAction(WorkspaceName $workspaceName): void * Rebase the current users personal workspace onto the given $targetWorkspace and then * redirects to the $targetNode in the content module. */ - public function rebaseAndRedirectAction(Node $targetNode, Workspace $targetWorkspace): void + public function rebaseAndRedirectAction(string $targetNode, Workspace $targetWorkspace): void { $contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest()) ->contentRepositoryId; $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); + // todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress + $targetNodeAddress = NodeAddressFactory::create($contentRepository)->createCoreNodeAddressFromLegacyUriString($targetNode); /** @var ?Account $currentAccount */ $currentAccount = $this->securityContext->getAccount(); @@ -482,10 +484,10 @@ public function rebaseAndRedirectAction(Node $targetNode, Workspace $targetWorks */ $targetNodeAddressInPersonalWorkspace = NodeAddress::create( - $targetNode->contentRepositoryId, + $targetNodeAddress->contentRepositoryId, $personalWorkspace->workspaceName, - $targetNode->dimensionSpacePoint, - $targetNode->aggregateId + $targetNodeAddress->dimensionSpacePoint, + $targetNodeAddress->aggregateId ); if ($this->packageManager->isPackageAvailable('Neos.Neos.Ui')) { @@ -526,13 +528,14 @@ public function publishNodeAction(string $nodeAddress, WorkspaceName $selectedWo ->contentRepositoryId; $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); $nodeAddressFactory = NodeAddressFactory::create($contentRepository); - $nodeAddress = $nodeAddressFactory->createFromUriString($nodeAddress); + // todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress + $nodeAddress = $nodeAddressFactory->createCoreNodeAddressFromLegacyUriString($nodeAddress); $command = PublishIndividualNodesFromWorkspace::create( $selectedWorkspace, NodeIdsToPublishOrDiscard::create( new NodeIdToPublishOrDiscard( - $nodeAddress->nodeAggregateId, + $nodeAddress->aggregateId, $nodeAddress->dimensionSpacePoint ) ), @@ -563,13 +566,14 @@ public function discardNodeAction(string $nodeAddress, WorkspaceName $selectedWo ->contentRepositoryId; $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); $nodeAddressFactory = NodeAddressFactory::create($contentRepository); - $nodeAddress = $nodeAddressFactory->createFromUriString($nodeAddress); + // todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress + $nodeAddress = $nodeAddressFactory->createCoreNodeAddressFromLegacyUriString($nodeAddress); $command = DiscardIndividualNodesFromWorkspace::create( $selectedWorkspace, NodeIdsToPublishOrDiscard::create( new NodeIdToPublishOrDiscard( - $nodeAddress->nodeAggregateId, + $nodeAddress->aggregateId, $nodeAddress->dimensionSpacePoint ) ), @@ -604,9 +608,10 @@ public function publishOrDiscardNodesAction(array $nodes, string $action, string $nodesToPublishOrDiscard = []; foreach ($nodes as $node) { - $nodeAddress = $nodeAddressFactory->createFromUriString($node); + // todo legacy uri node address notation used. Should be refactored to use json encoded NodeAddress + $nodeAddress = $nodeAddressFactory->createCoreNodeAddressFromLegacyUriString($node); $nodesToPublishOrDiscard[] = new NodeIdToPublishOrDiscard( - $nodeAddress->nodeAggregateId, + $nodeAddress->aggregateId, $nodeAddress->dimensionSpacePoint ); } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index c157d6569f9..376fce4e233 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -17,6 +17,7 @@ parameters: - Neos.ContentRepository.TestSuite/Classes - Neos.ContentRepositoryRegistry/Classes - Neos.Neos/Classes + - Neos.Workspace.Ui/Classes - Neos.TimeableNodeVisibility/Classes - Neos.NodeTypes.Form/Classes # todo lint whole fusion package From ba79300876b7b1dcfc0eeeab2a455d46718fe9a9 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 16 Jun 2024 10:48:25 +0200 Subject: [PATCH 2/5] TASK: Adjust LinkingService to not use legacy node address --- Neos.Neos/Classes/Service/LinkingService.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Neos.Neos/Classes/Service/LinkingService.php b/Neos.Neos/Classes/Service/LinkingService.php index fb520d62994..6354c69b937 100644 --- a/Neos.Neos/Classes/Service/LinkingService.php +++ b/Neos.Neos/Classes/Service/LinkingService.php @@ -36,7 +36,6 @@ use Neos\Neos\Domain\Model\Site; use Neos\Neos\Domain\Repository\SiteRepository; use Neos\Neos\Exception as NeosException; -use Neos\Neos\FrontendRouting\NodeAddressFactory; use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult; use Neos\Utility\Arrays; use Psr\Http\Message\UriInterface; @@ -309,7 +308,7 @@ public function createNodeUri( $controllerContext->getRequest()->getHttpRequest() )->contentRepositoryId; $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); - $nodeAddress = NodeAddressFactory::create($contentRepository)->createFromUriString($node); + $nodeAddress = NodeAddress::fromJsonString($nodeString); $workspace = $contentRepository->getWorkspaceFinder()->findOneByName($nodeAddress->workspaceName); $subgraph = $contentRepository->getContentGraph($nodeAddress->workspaceName)->getSubgraph( $nodeAddress->dimensionSpacePoint, @@ -317,7 +316,7 @@ public function createNodeUri( ? VisibilityConstraints::withoutRestrictions() : VisibilityConstraints::frontend() ); - $node = $subgraph->findNodeById($nodeAddress->nodeAggregateId); + $node = $subgraph->findNodeById($nodeAddress->aggregateId); } catch (\Throwable $exception) { if ($baseNode === null) { throw new NeosException( From 6d72c8ad4ffeedca14918a36865a70d2b66195a5 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:02:18 +0200 Subject: [PATCH 3/5] TASK: Adjust node property mappers to use new node address --- ...ter.php => NodeAddressToNodeConverter.php} | 33 ++++--------------- .../NodeToNodeAddressStringConverter.php | 19 +++-------- 2 files changed, 10 insertions(+), 42 deletions(-) rename Neos.Neos/Classes/TypeConverter/{HackyNodeAddressToNodeConverter.php => NodeAddressToNodeConverter.php} (55%) diff --git a/Neos.Neos/Classes/TypeConverter/HackyNodeAddressToNodeConverter.php b/Neos.Neos/Classes/TypeConverter/NodeAddressToNodeConverter.php similarity index 55% rename from Neos.Neos/Classes/TypeConverter/HackyNodeAddressToNodeConverter.php rename to Neos.Neos/Classes/TypeConverter/NodeAddressToNodeConverter.php index 9786c418fc9..c8744bb5eda 100644 --- a/Neos.Neos/Classes/TypeConverter/HackyNodeAddressToNodeConverter.php +++ b/Neos.Neos/Classes/TypeConverter/NodeAddressToNodeConverter.php @@ -16,25 +16,16 @@ use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; -use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; +use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Annotations as Flow; -use Neos\Flow\Core\Bootstrap; -use Neos\Flow\Http\RequestHandler; use Neos\Flow\Property\PropertyMappingConfigurationInterface; use Neos\Flow\Property\TypeConverter\AbstractTypeConverter; -use Neos\Neos\FrontendRouting\NodeAddressFactory; -use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult; /** - * To be removed legacy fragment for property mapping nodes in controllers. - * MUST not be used and MUST be removed before Neos 9 release. - * See issue: https://github.com/neos/neos-development-collection/issues/4873 - * * @Flow\Scope("singleton") - * @deprecated must be removed before Neos 9 release!!! */ -class HackyNodeAddressToNodeConverter extends AbstractTypeConverter +class NodeAddressToNodeConverter extends AbstractTypeConverter { /** * @var array @@ -53,8 +44,6 @@ class HackyNodeAddressToNodeConverter extends AbstractTypeConverter #[Flow\Inject] protected ContentRepositoryRegistry $contentRepositoryRegistry; - #[Flow\Inject] - protected Bootstrap $bootstrap; /** * @param string $source @@ -68,26 +57,16 @@ public function convertFrom( array $subProperties = [], PropertyMappingConfigurationInterface $configuration = null ) { - $activeRequestHandler = $this->bootstrap->getActiveRequestHandler(); - $contentRepositoryId = ContentRepositoryId::fromString('default'); - if ($activeRequestHandler instanceof RequestHandler) { - $httpRequest = $activeRequestHandler->getHttpRequest(); - $siteDetectionResult = SiteDetectionResult::fromRequest($httpRequest); - $contentRepositoryId = $siteDetectionResult->contentRepositoryId; - } - - $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); - $nodeAddressFactory = NodeAddressFactory::create($contentRepository); - $nodeAddress = $nodeAddressFactory->createFromUriString($source); - + $nodeAddress = NodeAddress::fromJsonString($source); + $contentRepository = $this->contentRepositoryRegistry->get($nodeAddress->contentRepositoryId); $subgraph = $contentRepository->getContentGraph($nodeAddress->workspaceName) ->getSubgraph( $nodeAddress->dimensionSpacePoint, - $nodeAddress->isInLiveWorkspace() + $nodeAddress->workspaceName->isLive() ? VisibilityConstraints::frontend() : VisibilityConstraints::withoutRestrictions() ); - return $subgraph->findNodeById($nodeAddress->nodeAggregateId); + return $subgraph->findNodeById($nodeAddress->aggregateId); } } diff --git a/Neos.Neos/Classes/TypeConverter/NodeToNodeAddressStringConverter.php b/Neos.Neos/Classes/TypeConverter/NodeToNodeAddressStringConverter.php index 7c296803ec8..cdb5f077c19 100644 --- a/Neos.Neos/Classes/TypeConverter/NodeToNodeAddressStringConverter.php +++ b/Neos.Neos/Classes/TypeConverter/NodeToNodeAddressStringConverter.php @@ -15,27 +15,19 @@ namespace Neos\Neos\TypeConverter; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; +use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Annotations as Flow; use Neos\Flow\Property\PropertyMappingConfigurationInterface; use Neos\Flow\Property\TypeConverter\AbstractTypeConverter; -use Neos\Neos\FrontendRouting\NodeAddressFactory; /** - * To be removed legacy fragment for property mapping nodes in controllers. - * MUST not be used and MUST be removed before Neos 9 release. - * See issue: https://github.com/neos/neos-development-collection/issues/4873 - * * @Flow\Scope("singleton") - * @deprecated must be removed before Neos 9 release!!! */ class NodeToNodeAddressStringConverter extends AbstractTypeConverter { - /** - * @Flow\Inject - * @var ContentRepositoryRegistry - */ - protected $contentRepositoryRegistry; + #[Flow\Inject] + protected ContentRepositoryRegistry $contentRepositoryRegistry; /** * @var array @@ -64,9 +56,6 @@ public function convertFrom( array $subProperties = [], PropertyMappingConfigurationInterface $configuration = null ) { - $contentRepository = $this->contentRepositoryRegistry->get( - $source->contentRepositoryId - ); - return NodeAddressFactory::create($contentRepository)->createFromNode($source)->serializeForUri(); + return NodeAddress::fromNode($source)->toJson(); } } From 931304f7ba76eccee6508c8fe63c13a813bcd239 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 16 Jun 2024 11:22:08 +0200 Subject: [PATCH 4/5] TASK: Adjust `Neos.Node.serializedNodeAddress` to use new node address --- Neos.Neos/Classes/Fusion/Helper/NodeHelper.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php b/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php index 3efcbad4b8e..5317ca9a715 100644 --- a/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php +++ b/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php @@ -21,13 +21,12 @@ use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindAncestorNodesFilter; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\Projection\ContentGraph\NodePath; -use Neos\ContentRepository\Core\Projection\NodeHiddenState\NodeHiddenStateFinder; +use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Eel\ProtectedContextAwareInterface; use Neos\Flow\Annotations as Flow; use Neos\Neos\Domain\Exception; use Neos\Neos\Domain\Service\NodeTypeNameFactory; -use Neos\Neos\FrontendRouting\NodeAddressFactory; use Neos\Neos\Presentation\VisualNodePath; use Neos\Neos\Utility\NodeTypeWithFallbackProvider; @@ -155,11 +154,7 @@ public function isNodeTypeExistent(Node $node): bool public function serializedNodeAddress(Node $node): string { - $contentRepository = $this->contentRepositoryRegistry->get( - $node->contentRepositoryId - ); - $nodeAddressFactory = NodeAddressFactory::create($contentRepository); - return $nodeAddressFactory->createFromNode($node)->serializeForUri(); + return NodeAddress::fromNode($node)->toJson(); } public function subgraphForNode(Node $node): ContentSubgraphInterface From 0f909058b31866571c3647d35439a67794fa856e Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:06:05 +0200 Subject: [PATCH 5/5] TASK: Remove `ContentStreamId` from legacy NodeAddress see https://github.com/neos/neos-development-collection/issues/5043 --- .../Classes/FrontendRouting/NodeAddress.php | 21 ++-------- .../FrontendRouting/NodeAddressFactory.php | 40 ++----------------- .../Controller/WorkspaceController.php | 4 +- 3 files changed, 9 insertions(+), 56 deletions(-) diff --git a/Neos.Neos/Classes/FrontendRouting/NodeAddress.php b/Neos.Neos/Classes/FrontendRouting/NodeAddress.php index 0f71cdaa166..08e0d85be27 100644 --- a/Neos.Neos/Classes/FrontendRouting/NodeAddress.php +++ b/Neos.Neos/Classes/FrontendRouting/NodeAddress.php @@ -22,16 +22,6 @@ use Neos\Flow\Annotations as Flow; /** - * A persistent, external "address" of a node; used to link to it. - * - * Describes the intention of the user making the current request: - * Show me - * node $nodeAggregateId - * in dimensions $dimensionSpacePoint - * in contentStreamId $contentStreamId - * - * It is used in Neos Routing to build a URI to a node. - * * @deprecated will be removed before Final 9.0 * The NodeAddress was added 6 years ago without the concept of multiple crs * Its usages will be replaced by the new node attached node address @@ -42,8 +32,9 @@ /** * @internal use NodeAddressFactory, if you want to create a NodeAddress */ + /** @phpstan-ignore-next-line its all just temporary */ public function __construct( - public ContentStreamId $contentStreamId, + ?ContentStreamId $_contentStreamId, public DimensionSpacePoint $dimensionSpacePoint, public NodeAggregateId $nodeAggregateId, public WorkspaceName $workspaceName @@ -59,16 +50,10 @@ public function serializeForUri(): string . '__' . $this->nodeAggregateId->value; } - public function isInLiveWorkspace(): bool - { - return $this->workspaceName->isLive(); - } - public function __toString(): string { return sprintf( - 'NodeAddress[contentStream=%s, dimensionSpacePoint=%s, nodeAggregateId=%s, workspaceName=%s]', - $this->contentStreamId->value, + 'NodeAddress[dimensionSpacePoint=%s, nodeAggregateId=%s, workspaceName=%s]', $this->dimensionSpacePoint->toJson(), $this->nodeAggregateId->value, $this->workspaceName->value diff --git a/Neos.Neos/Classes/FrontendRouting/NodeAddressFactory.php b/Neos.Neos/Classes/FrontendRouting/NodeAddressFactory.php index 9bc511fdcfe..b5169ae51c1 100644 --- a/Neos.Neos/Classes/FrontendRouting/NodeAddressFactory.php +++ b/Neos.Neos/Classes/FrontendRouting/NodeAddressFactory.php @@ -20,7 +20,6 @@ use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; -use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; /** @@ -38,35 +37,13 @@ public static function create(ContentRepository $contentRepository): self return new self($contentRepository); } - public function createFromContentStreamIdAndDimensionSpacePointAndNodeAggregateId( - ContentStreamId $contentStreamId, - DimensionSpacePoint $dimensionSpacePoint, - NodeAggregateId $nodeAggregateId - ): LegacyNodeAddress { - $workspace = $this->contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId( - $contentStreamId - ); - if ($workspace === null) { - throw new \RuntimeException( - 'Cannot build a NodeAddress for traversable node of aggregate ' . $nodeAggregateId->value - . ', because the content stream ' . $contentStreamId->value - . ' is not assigned to a workspace.' - ); - } - return new LegacyNodeAddress( - $contentStreamId, - $dimensionSpacePoint, - $nodeAggregateId, - $workspace->workspaceName, - ); - } - public function createFromNode(Node $node): LegacyNodeAddress { - return $this->createFromContentStreamIdAndDimensionSpacePointAndNodeAggregateId( - $node->subgraphIdentity->contentStreamId, + return new LegacyNodeAddress( + null, $node->dimensionSpacePoint, $node->aggregateId, + $node->workspaceName, ); } @@ -93,17 +70,8 @@ public function createFromUriString(string $serializedNodeAddress): LegacyNodeAd $dimensionSpacePoint = DimensionSpacePoint::fromArray(json_decode(base64_decode($dimensionSpacePointSerialized), true)); $nodeAggregateId = NodeAggregateId::fromString($nodeAggregateIdSerialized); - $contentStreamId = $this->contentRepository->getWorkspaceFinder()->findOneByName($workspaceName) - ?->currentContentStreamId; - if (is_null($contentStreamId)) { - throw new \InvalidArgumentException( - 'Could not resolve content stream identifier for node address ' . $serializedNodeAddress, - 1645363784 - ); - } - return new LegacyNodeAddress( - $contentStreamId, + null, $dimensionSpacePoint, $nodeAggregateId, $workspaceName diff --git a/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php b/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php index 2ba5e17b7ec..b77ebe018c5 100644 --- a/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php +++ b/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php @@ -493,7 +493,7 @@ public function rebaseAndRedirectAction(string $targetNode, Workspace $targetWor if ($this->packageManager->isPackageAvailable('Neos.Neos.Ui')) { // todo remove me legacy $legacyTargetNodeAddressInPersonalWorkspace = new LegacyNodeAddress( - $personalWorkspace->currentContentStreamId, + null, $targetNodeAddressInPersonalWorkspace->dimensionSpacePoint, $targetNodeAddressInPersonalWorkspace->aggregateId, $targetNodeAddressInPersonalWorkspace->workspaceName @@ -839,7 +839,7 @@ protected function computeSiteChanges(Workspace $selectedWorkspace, ContentRepos // we can't create `serializedNodeAddress` from the node. // Instead, we use the original stored values. $nodeAddress = new LegacyNodeAddress( - $change->contentStreamId, + null, $change->originDimensionSpacePoint->toDimensionSpacePoint(), $change->nodeAggregateId, $selectedWorkspace->workspaceName