From eaeb7178cddab29411915d7581a340cd286e7ab8 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 30 Jun 2024 13:54:27 +0200 Subject: [PATCH] TASK: adjust to Command Api changes in Neos see https://github.com/neos/neos-development-collection/pull/5082 --- .../Domain/Model/Changes/AbstractCreate.php | 19 ++++++++++--------- Classes/Domain/Model/Changes/CopyAfter.php | 3 +-- Classes/Domain/Model/Changes/CopyBefore.php | 3 +-- Classes/Domain/Model/Changes/CopyInto.php | 1 - 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Classes/Domain/Model/Changes/AbstractCreate.php b/Classes/Domain/Model/Changes/AbstractCreate.php index 118de197fd..ab126f53f3 100644 --- a/Classes/Domain/Model/Changes/AbstractCreate.php +++ b/Classes/Domain/Model/Changes/AbstractCreate.php @@ -127,7 +127,7 @@ public function getNodeAggregateId(): ?NodeAggregateId */ protected function createNode( Node $parentNode, - NodeAggregateId $succeedingSiblingNodeAggregateId = null + ?NodeAggregateId $succeedingSiblingNodeAggregateId = null ): Node { $nodeTypeName = $this->getNodeTypeName(); if (is_null($nodeTypeName)) { @@ -140,23 +140,24 @@ protected function createNode( throw new \RuntimeException(sprintf('Cannot run create node because the node type %s is missing.', $nodeTypeName->value), 1716019747); } - $nodeName = $this->getName() - ? NodeName::fromString($this->getName()) - : null; - $nodeAggregateId = $this->getNodeAggregateId() ?? NodeAggregateId::create(); // generate a new NodeAggregateId - $command = CreateNodeAggregateWithNode::create( $parentNode->workspaceName, $nodeAggregateId, $nodeTypeName, OriginDimensionSpacePoint::fromDimensionSpacePoint($parentNode->dimensionSpacePoint), - $parentNode->aggregateId, - $succeedingSiblingNodeAggregateId, - $nodeName + $parentNode->aggregateId ); + if ($succeedingSiblingNodeAggregateId) { + $command = $command->withSucceedingSiblingNodeAggregateId($succeedingSiblingNodeAggregateId); + } + + if ($this->getName()) { + $command = $command->withNodeName(NodeName::fromString($this->getName())); + } + $commands = $this->applyNodeCreationHandlers( NodeCreationCommands::fromFirstCommand( $command, diff --git a/Classes/Domain/Model/Changes/CopyAfter.php b/Classes/Domain/Model/Changes/CopyAfter.php index a08e0ad744..30d3dfc638 100644 --- a/Classes/Domain/Model/Changes/CopyAfter.php +++ b/Classes/Domain/Model/Changes/CopyAfter.php @@ -72,8 +72,7 @@ public function apply(): void $subject, OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->dimensionSpacePoint), $parentNodeOfPreviousSibling->aggregateId, - $succeedingSibling?->aggregateId, - null + $succeedingSibling?->aggregateId ); $contentRepository->handle($command); diff --git a/Classes/Domain/Model/Changes/CopyBefore.php b/Classes/Domain/Model/Changes/CopyBefore.php index d744f2b762..87e0881b6d 100644 --- a/Classes/Domain/Model/Changes/CopyBefore.php +++ b/Classes/Domain/Model/Changes/CopyBefore.php @@ -67,8 +67,7 @@ public function apply(): void $subject, OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->dimensionSpacePoint), $parentNodeOfSucceedingSibling->aggregateId, - $succeedingSibling->aggregateId, - null + $succeedingSibling->aggregateId ); $contentRepository->handle($command); diff --git a/Classes/Domain/Model/Changes/CopyInto.php b/Classes/Domain/Model/Changes/CopyInto.php index 8e21e38346..8940173219 100644 --- a/Classes/Domain/Model/Changes/CopyInto.php +++ b/Classes/Domain/Model/Changes/CopyInto.php @@ -77,7 +77,6 @@ public function apply(): void $subject, OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->dimensionSpacePoint), $parentNode->aggregateId, - null, null ); $contentRepository->handle($command);