Skip to content

Commit

Permalink
TASK: adjust to Command Api changes in Neos
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Jul 7, 2024
1 parent bdff700 commit 13aaba1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
14 changes: 6 additions & 8 deletions Classes/Domain/Model/Changes/AbstractCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -140,23 +140,21 @@ 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
$succeedingSiblingNodeAggregateId
);

if ($this->getName()) {
$command = $command->withNodeName(NodeName::fromString($this->getName()));
}

$commands = $this->applyNodeCreationHandlers(
NodeCreationCommands::fromFirstCommand(
$command,
Expand Down
3 changes: 1 addition & 2 deletions Classes/Domain/Model/Changes/CopyAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ public function apply(): void
$subject,
OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->dimensionSpacePoint),
$parentNodeOfPreviousSibling->aggregateId,
$succeedingSibling?->aggregateId,
null
$succeedingSibling?->aggregateId
);

$contentRepository->handle($command);
Expand Down
3 changes: 1 addition & 2 deletions Classes/Domain/Model/Changes/CopyBefore.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ public function apply(): void
$subject,
OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->dimensionSpacePoint),
$parentNodeOfSucceedingSibling->aggregateId,
$succeedingSibling->aggregateId,
null
$succeedingSibling->aggregateId
);

$contentRepository->handle($command);
Expand Down
1 change: 0 additions & 1 deletion Classes/Domain/Model/Changes/CopyInto.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public function apply(): void
$subject,
OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->dimensionSpacePoint),
$parentNode->aggregateId,
null,
null
);
$contentRepository->handle($command);
Expand Down

0 comments on commit 13aaba1

Please sign in to comment.