diff --git a/Classes/Controller/BackendServiceController.php b/Classes/Controller/BackendServiceController.php index 37b09703a7..fa6be96d93 100644 --- a/Classes/Controller/BackendServiceController.php +++ b/Classes/Controller/BackendServiceController.php @@ -338,14 +338,9 @@ public function changeBaseWorkspaceAction(string $targetWorkspaceName, string $d $currentAccount->getAccountIdentifier() )->toContentRepositoryWorkspaceName(); + $command = ChangeBaseWorkspace::create($userWorkspaceName, WorkspaceName::fromString($targetWorkspaceName)); try { - $contentRepository->handle( - new ChangeBaseWorkspace( - $userWorkspaceName, - WorkspaceName::fromString($targetWorkspaceName), - $newCOnt = ContentStreamId::create() - ) - )->block(); + $contentRepository->handle($command)->block(); } catch (WorkspaceIsNotEmptyException $exception) { $error = new Error(); $error->setMessage('Your personal workspace currently contains unpublished changes.' @@ -366,7 +361,7 @@ public function changeBaseWorkspaceAction(string $targetWorkspaceName, string $d $subgraph = $contentRepository->getContentGraph() ->getSubgraph( - $newCOnt, + $command->newContentStreamId, $nodeAddress->dimensionSpacePoint, VisibilityConstraints::withoutRestrictions() ); diff --git a/Classes/Domain/Model/Changes/AbstractCreate.php b/Classes/Domain/Model/Changes/AbstractCreate.php index a8aa6a5bcb..51839ee3b8 100644 --- a/Classes/Domain/Model/Changes/AbstractCreate.php +++ b/Classes/Domain/Model/Changes/AbstractCreate.php @@ -103,7 +103,7 @@ protected function createNode( $nodeAggregateId = NodeAggregateId::create(); // generate a new NodeAggregateId - $command = new CreateNodeAggregateWithNode( + $command = CreateNodeAggregateWithNode::create( $parentNode->subgraphIdentity->contentStreamId, $nodeAggregateId, $nodeTypeName, diff --git a/Classes/Domain/Model/Changes/MoveAfter.php b/Classes/Domain/Model/Changes/MoveAfter.php index 99df888cfc..4e5cd4d8de 100644 --- a/Classes/Domain/Model/Changes/MoveAfter.php +++ b/Classes/Domain/Model/Changes/MoveAfter.php @@ -71,14 +71,14 @@ public function apply(): void $hasEqualParentNode = $parentNode->nodeAggregateId ->equals($parentNodeOfPreviousSibling->nodeAggregateId); - $command = new MoveNodeAggregate( + $command = MoveNodeAggregate::create( $subject->subgraphIdentity->contentStreamId, $subject->subgraphIdentity->dimensionSpacePoint, $subject->nodeAggregateId, + RelationDistributionStrategy::STRATEGY_GATHER_ALL, $hasEqualParentNode ? null : $parentNodeOfPreviousSibling->nodeAggregateId, $precedingSibling->nodeAggregateId, $succeedingSibling?->nodeAggregateId, - RelationDistributionStrategy::STRATEGY_GATHER_ALL ); $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); diff --git a/Classes/Domain/Model/Changes/MoveBefore.php b/Classes/Domain/Model/Changes/MoveBefore.php index 27d1078c07..1c7ac8bcce 100644 --- a/Classes/Domain/Model/Changes/MoveBefore.php +++ b/Classes/Domain/Model/Changes/MoveBefore.php @@ -69,16 +69,16 @@ public function apply(): void $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); $contentRepository->handle( - new MoveNodeAggregate( + MoveNodeAggregate::create( $subject->subgraphIdentity->contentStreamId, $subject->subgraphIdentity->dimensionSpacePoint, $subject->nodeAggregateId, + RelationDistributionStrategy::STRATEGY_GATHER_ALL, $hasEqualParentNode ? null : $succeedingSiblingParent->nodeAggregateId, $precedingSibling?->nodeAggregateId, $succeedingSibling->nodeAggregateId, - RelationDistributionStrategy::STRATEGY_GATHER_ALL ) )->block(); diff --git a/Classes/Domain/Model/Changes/MoveInto.php b/Classes/Domain/Model/Changes/MoveInto.php index 4ca90a9b54..aa4697c26a 100644 --- a/Classes/Domain/Model/Changes/MoveInto.php +++ b/Classes/Domain/Model/Changes/MoveInto.php @@ -80,14 +80,12 @@ public function apply(): void $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); $contentRepository->handle( - new MoveNodeAggregate( + MoveNodeAggregate::create( $subject->subgraphIdentity->contentStreamId, $subject->subgraphIdentity->dimensionSpacePoint, $subject->nodeAggregateId, + RelationDistributionStrategy::STRATEGY_GATHER_ALL, $hasEqualParentNode ? null : $parentNode->nodeAggregateId, - null, - null, - RelationDistributionStrategy::STRATEGY_GATHER_ALL ) )->block(); diff --git a/Classes/Domain/Model/Changes/Property.php b/Classes/Domain/Model/Changes/Property.php index 1b0a2cba00..86985767bd 100644 --- a/Classes/Domain/Model/Changes/Property.php +++ b/Classes/Domain/Model/Changes/Property.php @@ -191,7 +191,7 @@ public function apply(): void $originDimensionSpacePoint = OriginDimensionSpacePoint::fromDimensionSpacePoint($subject->subgraphIdentity->dimensionSpacePoint); // if origin dimension space point != current DSP -> translate transparently (matching old behavior) $contentRepository->handle( - new CreateNodeVariant( + CreateNodeVariant::create( $subject->subgraphIdentity->contentStreamId, $subject->nodeAggregateId, $subject->originDimensionSpacePoint, @@ -200,7 +200,7 @@ public function apply(): void )->block(); } $commandResult = $contentRepository->handle( - new SetNodeProperties( + SetNodeProperties::create( $subject->subgraphIdentity->contentStreamId, $subject->nodeAggregateId, $originDimensionSpacePoint, @@ -215,7 +215,7 @@ public function apply(): void // property starts with "_" if ($propertyName === '_nodeType') { $commandResult = $contentRepository->handle( - new ChangeNodeAggregateType( + ChangeNodeAggregateType::create( $subject->subgraphIdentity->contentStreamId, $subject->nodeAggregateId, NodeTypeName::fromString($value), @@ -225,7 +225,7 @@ public function apply(): void } elseif ($propertyName === '_hidden') { if ($value === true) { $commandResult = $contentRepository->handle( - new DisableNodeAggregate( + DisableNodeAggregate::create( $subject->subgraphIdentity->contentStreamId, $subject->nodeAggregateId, $subject->originDimensionSpacePoint->toDimensionSpacePoint(), @@ -235,7 +235,7 @@ public function apply(): void } else { // unhide $commandResult = $contentRepository->handle( - new EnableNodeAggregate( + EnableNodeAggregate::create( $subject->subgraphIdentity->contentStreamId, $subject->nodeAggregateId, $subject->originDimensionSpacePoint->toDimensionSpacePoint(), diff --git a/Classes/Domain/Model/Changes/Remove.php b/Classes/Domain/Model/Changes/Remove.php index c7719debca..f204d69af3 100644 --- a/Classes/Domain/Model/Changes/Remove.php +++ b/Classes/Domain/Model/Changes/Remove.php @@ -69,13 +69,15 @@ public function apply(): void $this->updateWorkspaceInfo(); $closestDocumentParentNode = $this->findClosestDocumentNode($subject); - $command = new RemoveNodeAggregate( + $command = RemoveNodeAggregate::create( $subject->subgraphIdentity->contentStreamId, $subject->nodeAggregateId, $subject->subgraphIdentity->dimensionSpacePoint, NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS, - $closestDocumentParentNode?->nodeAggregateId ); + if ($closestDocumentParentNode !== null) { + $command = $command->withRemovalAttachmentPoint($closestDocumentParentNode?->nodeAggregateId); + } $contentRepository = $this->contentRepositoryRegistry->get($subject->subgraphIdentity->contentRepositoryId); $contentRepository->handle($command)->block(); diff --git a/Classes/Service/PublishingService.php b/Classes/Service/PublishingService.php index d00ca3f7f1..36595ca7f4 100644 --- a/Classes/Service/PublishingService.php +++ b/Classes/Service/PublishingService.php @@ -38,7 +38,7 @@ public function publishWorkspace(ContentRepository $contentRepository, Workspace )->block(); $contentRepository->handle( - new PublishWorkspace( + PublishWorkspace::create( $workspaceName ) )->block();