diff --git a/Classes/ContentRepository/Service/WorkspaceService.php b/Classes/ContentRepository/Service/WorkspaceService.php index 2103322b8a..2880c2768e 100644 --- a/Classes/ContentRepository/Service/WorkspaceService.php +++ b/Classes/ContentRepository/Service/WorkspaceService.php @@ -179,13 +179,13 @@ public function predictRemoveNodeFeedbackFromDiscardIndividualNodesFromWorkspace } if ( - $nodeToDiscard->contentStreamId->equals($change->contentStreamId) + $nodeToDiscard->workspaceName->equals($workspace->workspaceName) && $nodeToDiscard->nodeAggregateId->equals($change->nodeAggregateId) && $nodeToDiscard->dimensionSpacePoint->equals($change->originDimensionSpacePoint) ) { $subgraph = $contentRepository->getContentGraph() ->getSubgraph( - $nodeToDiscard->contentStreamId, + $workspace->currentContentStreamId, $nodeToDiscard->dimensionSpacePoint, VisibilityConstraints::withoutRestrictions() ); diff --git a/Classes/Controller/BackendServiceController.php b/Classes/Controller/BackendServiceController.php index adc388d582..c1266be471 100644 --- a/Classes/Controller/BackendServiceController.php +++ b/Classes/Controller/BackendServiceController.php @@ -221,7 +221,7 @@ public function publishAction(array $nodeContextPaths, string $targetWorkspaceNa foreach ($nodeContextPaths as $contextPath) { $nodeAddress = $nodeAddressFactory->createFromUriString($contextPath); $nodeIdentifiersToPublish[] = new NodeIdToPublishOrDiscard( - $nodeAddress->contentStreamId, + $workspaceName, $nodeAddress->nodeAggregateId, $nodeAddress->dimensionSpacePoint ); @@ -279,7 +279,7 @@ public function discardAction(array $nodeContextPaths): void foreach ($nodeContextPaths as $contextPath) { $nodeAddress = $nodeAddressFactory->createFromUriString($contextPath); $nodeIdentifiersToDiscard[] = new NodeIdToPublishOrDiscard( - $nodeAddress->contentStreamId, + $workspaceName, $nodeAddress->nodeAggregateId, $nodeAddress->dimensionSpacePoint ); diff --git a/Classes/Domain/Model/Changes/AbstractCreate.php b/Classes/Domain/Model/Changes/AbstractCreate.php index 6cebb1e932..11ec715e95 100644 --- a/Classes/Domain/Model/Changes/AbstractCreate.php +++ b/Classes/Domain/Model/Changes/AbstractCreate.php @@ -108,8 +108,17 @@ protected function createNode( $nodeAggregateId = NodeAggregateId::create(); // generate a new NodeAggregateId + $contentRepository = $this->contentRepositoryRegistry->get($parentNode->subgraphIdentity->contentRepositoryId); + $workspace = $this->contentRepositoryRegistry->get($this->subject->subgraphIdentity->contentRepositoryId) + ->getWorkspaceFinder()->findOneByCurrentContentStreamId($parentNode->subgraphIdentity->contentStreamId); + if (!$workspace) { + throw new \Exception( + 'Could not find workspace for content stream "' . $parentNode->subgraphIdentity->contentStreamId->value . '"', + 1699008140 + ); + } $command = CreateNodeAggregateWithNode::create( - $parentNode->subgraphIdentity->contentStreamId, + $workspace->workspaceName, $nodeAggregateId, $nodeTypeName, OriginDimensionSpacePoint::fromDimensionSpacePoint($parentNode->subgraphIdentity->dimensionSpacePoint), @@ -117,7 +126,6 @@ protected function createNode( $succeedingSiblingNodeAggregateId, $nodeName ); - $contentRepository = $this->contentRepositoryRegistry->get($parentNode->subgraphIdentity->contentRepositoryId); $command = $this->applyNodeCreationHandlers($command, $nodeTypeName, $contentRepository); diff --git a/Classes/Domain/Model/Changes/CopyAfter.php b/Classes/Domain/Model/Changes/CopyAfter.php index df9f0afb26..a297059da1 100644 --- a/Classes/Domain/Model/Changes/CopyAfter.php +++ b/Classes/Domain/Model/Changes/CopyAfter.php @@ -71,12 +71,17 @@ public function apply(): void $targetNodeName = NodeName::fromString(uniqid('node-')); $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); + $workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId); + if (!$workspace) { + throw new \Exception('Could not find workspace for content stream', 1699004343); + } $command = CopyNodesRecursively::createFromSubgraphAndStartNode( $contentRepository->getContentGraph()->getSubgraph( $subject->subgraphIdentity->contentStreamId, $subject->subgraphIdentity->dimensionSpacePoint, VisibilityConstraints::withoutRestrictions() ), + $workspace->workspaceName, $subject, OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->subgraphIdentity->dimensionSpacePoint), $parentNodeOfPreviousSibling->nodeAggregateId, diff --git a/Classes/Domain/Model/Changes/CopyBefore.php b/Classes/Domain/Model/Changes/CopyBefore.php index 477c2c11c4..f69d4f86c2 100644 --- a/Classes/Domain/Model/Changes/CopyBefore.php +++ b/Classes/Domain/Model/Changes/CopyBefore.php @@ -63,13 +63,17 @@ public function apply(): void ) { $targetNodeName = NodeName::fromString(uniqid('node-')); - $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); + $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId);$workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId); + if (!$workspace) { + throw new \Exception('Could not find workspace for content stream', 1699004343); + } $command = CopyNodesRecursively::createFromSubgraphAndStartNode( $contentRepository->getContentGraph()->getSubgraph( $subject->subgraphIdentity->contentStreamId, $subject->subgraphIdentity->dimensionSpacePoint, $subject->subgraphIdentity->visibilityConstraints ), + $workspace->workspaceName, $subject, OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->subgraphIdentity->dimensionSpacePoint), $parentNodeOfSucceedingSibling->nodeAggregateId, diff --git a/Classes/Domain/Model/Changes/CopyInto.php b/Classes/Domain/Model/Changes/CopyInto.php index 122d9b16df..c5ed872a9e 100644 --- a/Classes/Domain/Model/Changes/CopyInto.php +++ b/Classes/Domain/Model/Changes/CopyInto.php @@ -72,12 +72,17 @@ public function apply(): void $targetNodeName = NodeName::fromString(uniqid('node-')); $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); + $workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId); + if (!$workspace) { + throw new \Exception('Could not find workspace for content stream', 1699004343); + } $command = CopyNodesRecursively::createFromSubgraphAndStartNode( $contentRepository->getContentGraph()->getSubgraph( $subject->subgraphIdentity->contentStreamId, $subject->subgraphIdentity->dimensionSpacePoint, $subject->subgraphIdentity->visibilityConstraints ), + $workspace->workspaceName, $subject, OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->subgraphIdentity->dimensionSpacePoint), $parentNode->nodeAggregateId, diff --git a/Classes/Domain/Model/Changes/MoveAfter.php b/Classes/Domain/Model/Changes/MoveAfter.php index c2405ca396..8c22dd28f1 100644 --- a/Classes/Domain/Model/Changes/MoveAfter.php +++ b/Classes/Domain/Model/Changes/MoveAfter.php @@ -76,8 +76,19 @@ public function apply(): void $hasEqualParentNode = $parentNode->nodeAggregateId ->equals($parentNodeOfPreviousSibling->nodeAggregateId); + + $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); + $workspace = $this->contentRepositoryRegistry->get($this->subject->subgraphIdentity->contentRepositoryId) + ->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId); + if (!$workspace) { + throw new \Exception( + 'Could not find workspace for content stream "' . $subject->subgraphIdentity->contentStreamId->value . '"', + 1699008140 + ); + } + $command = MoveNodeAggregate::create( - $subject->subgraphIdentity->contentStreamId, + $workspace->workspaceName, $subject->subgraphIdentity->dimensionSpacePoint, $subject->nodeAggregateId, RelationDistributionStrategy::STRATEGY_GATHER_ALL, @@ -85,8 +96,6 @@ public function apply(): void $precedingSibling->nodeAggregateId, $succeedingSibling?->nodeAggregateId, ); - - $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); $contentRepository->handle($command)->block(); $updateParentNodeInfo = new UpdateNodeInfo(); diff --git a/Classes/Domain/Model/Changes/MoveBefore.php b/Classes/Domain/Model/Changes/MoveBefore.php index 276ac2fa26..d2a33b0adb 100644 --- a/Classes/Domain/Model/Changes/MoveBefore.php +++ b/Classes/Domain/Model/Changes/MoveBefore.php @@ -71,11 +71,18 @@ public function apply(): void $hasEqualParentNode = $parentNode->nodeAggregateId ->equals($succeedingSiblingParent->nodeAggregateId); - $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); + $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId);$workspace = $this->contentRepositoryRegistry->get($this->subject->subgraphIdentity->contentRepositoryId) + ->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId); + if (!$workspace) { + throw new \Exception( + 'Could not find workspace for content stream "' . $subject->subgraphIdentity->contentStreamId->value . '"', + 1699008140 + ); + } $contentRepository->handle( MoveNodeAggregate::create( - $subject->subgraphIdentity->contentStreamId, + $workspace->workspaceName, $subject->subgraphIdentity->dimensionSpacePoint, $subject->nodeAggregateId, RelationDistributionStrategy::STRATEGY_GATHER_ALL, diff --git a/Classes/Domain/Model/Changes/MoveInto.php b/Classes/Domain/Model/Changes/MoveInto.php index cde5731fa7..07cac0ca9c 100644 --- a/Classes/Domain/Model/Changes/MoveInto.php +++ b/Classes/Domain/Model/Changes/MoveInto.php @@ -15,7 +15,6 @@ use Neos\ContentRepository\Core\Feature\NodeMove\Command\MoveNodeAggregate; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\Feature\NodeMove\Dto\RelationDistributionStrategy; -use Neos\Neos\Ui\Domain\Model\Feedback\Operations\RemoveNode; use Neos\Neos\Ui\Domain\Model\Feedback\Operations\UpdateNodeInfo; /** @@ -83,10 +82,17 @@ public function apply(): void $hasEqualParentNode = $otherParent && $otherParent->nodeAggregateId ->equals($parentNode->nodeAggregateId); - $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); + $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId);$workspace = $this->contentRepositoryRegistry->get($this->subject->subgraphIdentity->contentRepositoryId) + ->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId); + if (!$workspace) { + throw new \Exception( + 'Could not find workspace for content stream "' . $subject->subgraphIdentity->contentStreamId->value . '"', + 1699008140 + ); + } $contentRepository->handle( MoveNodeAggregate::create( - $subject->subgraphIdentity->contentStreamId, + $workspace->workspaceName, $subject->subgraphIdentity->dimensionSpacePoint, $subject->nodeAggregateId, RelationDistributionStrategy::STRATEGY_GATHER_ALL, diff --git a/Classes/Domain/Model/Changes/Property.php b/Classes/Domain/Model/Changes/Property.php index 1e84723168..c9cff3c04c 100644 --- a/Classes/Domain/Model/Changes/Property.php +++ b/Classes/Domain/Model/Changes/Property.php @@ -38,9 +38,6 @@ use Neos\Neos\Ui\Domain\Service\NodePropertyConversionService; use Neos\Neos\Utility\NodeTypeWithFallbackProvider; -/** @codingStandardsIgnoreStart */ -/** @codingStandardsIgnoreEnd */ - /** * Changes a property on a node * @internal These objects internally reflect possible operations made by the Neos.Ui. @@ -158,6 +155,15 @@ public function apply(): void $propertyType = $this->getNodeType($subject)->getPropertyType($propertyName); + $workspace = $this->contentRepositoryRegistry->get($this->subject->subgraphIdentity->contentRepositoryId) + ->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId); + if (!$workspace) { + throw new \Exception( + 'Could not find workspace for content stream "' . $subject->subgraphIdentity->contentStreamId->value . '"', + 1699008140 + ); + } + // Use extra commands for reference handling if ($propertyType === 'reference' || $propertyType === 'references') { $value = $this->getValue(); @@ -180,7 +186,7 @@ public function apply(): void $commandResult = $contentRepository->handle( SetNodeReferences::create( - $subject->subgraphIdentity->contentStreamId, + $workspace->workspaceName, $subject->nodeAggregateId, $subject->originDimensionSpacePoint, ReferenceName::fromString($propertyName), @@ -201,7 +207,7 @@ public function apply(): void // if origin dimension space point != current DSP -> translate transparently (matching old behavior) $contentRepository->handle( CreateNodeVariant::create( - $subject->subgraphIdentity->contentStreamId, + $workspace->workspaceName, $subject->nodeAggregateId, $subject->originDimensionSpacePoint, $originDimensionSpacePoint @@ -210,7 +216,7 @@ public function apply(): void } $commandResult = $contentRepository->handle( SetNodeProperties::create( - $subject->subgraphIdentity->contentStreamId, + $workspace->workspaceName, $subject->nodeAggregateId, $originDimensionSpacePoint, PropertyValuesToWrite::fromArray( @@ -225,7 +231,7 @@ public function apply(): void if ($propertyName === '_nodeType') { $commandResult = $contentRepository->handle( ChangeNodeAggregateType::create( - $subject->subgraphIdentity->contentStreamId, + $workspace->workspaceName, $subject->nodeAggregateId, NodeTypeName::fromString($value), NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy::STRATEGY_DELETE @@ -235,7 +241,7 @@ public function apply(): void if ($value === true) { $commandResult = $contentRepository->handle( DisableNodeAggregate::create( - $subject->subgraphIdentity->contentStreamId, + $workspace->workspaceName, $subject->nodeAggregateId, $subject->originDimensionSpacePoint->toDimensionSpacePoint(), NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS @@ -245,7 +251,7 @@ public function apply(): void // unhide $commandResult = $contentRepository->handle( EnableNodeAggregate::create( - $subject->subgraphIdentity->contentStreamId, + $workspace->workspaceName, $subject->nodeAggregateId, $subject->originDimensionSpacePoint->toDimensionSpacePoint(), NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS diff --git a/Classes/Domain/Model/Changes/Remove.php b/Classes/Domain/Model/Changes/Remove.php index 872d84422a..b7b441d901 100644 --- a/Classes/Domain/Model/Changes/Remove.php +++ b/Classes/Domain/Model/Changes/Remove.php @@ -74,8 +74,16 @@ public function apply(): void $subgraph = $this->contentRepositoryRegistry->subgraphForNode($this->subject); $closestDocumentParentNode = $subgraph->findClosestNode($this->subject->nodeAggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT)); + $workspace = $this->contentRepositoryRegistry->get($this->subject->subgraphIdentity->contentRepositoryId) + ->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId); + if (!$workspace) { + throw new \Exception( + 'Could not find workspace for content stream "' . $subject->subgraphIdentity->contentStreamId->value . '"', + 1699008140 + ); + } $command = RemoveNodeAggregate::create( - $subject->subgraphIdentity->contentStreamId, + $workspace->workspaceName, $subject->nodeAggregateId, $subject->subgraphIdentity->dimensionSpacePoint, NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS,