diff --git a/Classes/Domain/Model/Changes/CopyAfter.php b/Classes/Domain/Model/Changes/CopyAfter.php index a195a71884..65e7bbdb73 100644 --- a/Classes/Domain/Model/Changes/CopyAfter.php +++ b/Classes/Domain/Model/Changes/CopyAfter.php @@ -68,8 +68,6 @@ public function apply(): void // do nothing; $succeedingSibling is null. } - $targetNodeName = NodeName::fromString(uniqid('node-')); - $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); $workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId); if (!$workspace) { @@ -85,14 +83,14 @@ public function apply(): void OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->subgraphIdentity->dimensionSpacePoint), $parentNodeOfPreviousSibling->nodeAggregateId, $succeedingSibling?->nodeAggregateId, - $targetNodeName + null ); + $contentRepository->handle($command)->block(); $newlyCreatedNode = $this->contentRepositoryRegistry->subgraphForNode($parentNodeOfPreviousSibling) - ->findNodeByPath( - $targetNodeName, - $parentNodeOfPreviousSibling->nodeAggregateId + ->findNodeById( + $command->nodeAggregateIdMapping->getNewNodeAggregateId($subject->nodeAggregateId) ); $this->finish($newlyCreatedNode); // NOTE: we need to run "finish" before "addNodeCreatedFeedback" diff --git a/Classes/Domain/Model/Changes/CopyBefore.php b/Classes/Domain/Model/Changes/CopyBefore.php index 0109f2c340..368bb5034a 100644 --- a/Classes/Domain/Model/Changes/CopyBefore.php +++ b/Classes/Domain/Model/Changes/CopyBefore.php @@ -61,8 +61,6 @@ public function apply(): void if ($this->canApply() && !is_null($subject) && !is_null($succeedingSibling) && !is_null($parentNodeOfSucceedingSibling) ) { - $targetNodeName = NodeName::fromString(uniqid('node-')); - $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); $workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId); if (!$workspace) { @@ -78,14 +76,14 @@ public function apply(): void OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->subgraphIdentity->dimensionSpacePoint), $parentNodeOfSucceedingSibling->nodeAggregateId, $succeedingSibling->nodeAggregateId, - $targetNodeName + null ); + $contentRepository->handle($command)->block(); $newlyCreatedNode = $this->contentRepositoryRegistry->subgraphForNode($parentNodeOfSucceedingSibling) - ->findNodeByPath( - $targetNodeName, - $parentNodeOfSucceedingSibling->nodeAggregateId + ->findNodeById( + $command->nodeAggregateIdMapping->getNewNodeAggregateId($subject->nodeAggregateId) ); $this->finish($newlyCreatedNode); // NOTE: we need to run "finish" before "addNodeCreatedFeedback" diff --git a/Classes/Domain/Model/Changes/CopyInto.php b/Classes/Domain/Model/Changes/CopyInto.php index 23990931ed..5e2bca0bcc 100644 --- a/Classes/Domain/Model/Changes/CopyInto.php +++ b/Classes/Domain/Model/Changes/CopyInto.php @@ -69,8 +69,6 @@ public function apply(): void $subject = $this->getSubject(); $parentNode = $this->getParentNode(); if ($parentNode && $subject && $this->canApply()) { - $targetNodeName = NodeName::fromString(uniqid('node-')); - $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); $workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($subject->subgraphIdentity->contentStreamId); if (!$workspace) { @@ -86,14 +84,13 @@ public function apply(): void OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->subgraphIdentity->dimensionSpacePoint), $parentNode->nodeAggregateId, null, - $targetNodeName + null ); $contentRepository->handle($command)->block(); $newlyCreatedNode = $this->contentRepositoryRegistry->subgraphForNode($parentNode) - ->findNodeByPath( - $targetNodeName, - $parentNode->nodeAggregateId + ->findNodeById( + $command->nodeAggregateIdMapping->getNewNodeAggregateId($subject->nodeAggregateId), ); $this->finish($newlyCreatedNode); // NOTE: we need to run "finish" before "addNodeCreatedFeedback"