Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Adjust to overhauled command constructors #3612

Merged
merged 3 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions Classes/Controller/BackendServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand All @@ -366,7 +361,7 @@ public function changeBaseWorkspaceAction(string $targetWorkspaceName, string $d

$subgraph = $contentRepository->getContentGraph()
->getSubgraph(
$newCOnt,
$command->newContentStreamId,
$nodeAddress->dimensionSpacePoint,
VisibilityConstraints::withoutRestrictions()
);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Model/Changes/AbstractCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions Classes/Domain/Model/Changes/MoveAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Classes/Domain/Model/Changes/MoveBefore.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 2 additions & 4 deletions Classes/Domain/Model/Changes/MoveInto.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
10 changes: 5 additions & 5 deletions Classes/Domain/Model/Changes/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -200,7 +200,7 @@ public function apply(): void
)->block();
}
$commandResult = $contentRepository->handle(
new SetNodeProperties(
SetNodeProperties::create(
$subject->subgraphIdentity->contentStreamId,
$subject->nodeAggregateId,
$originDimensionSpacePoint,
Expand All @@ -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),
Expand All @@ -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(),
Expand All @@ -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(),
Expand Down
6 changes: 4 additions & 2 deletions Classes/Domain/Model/Changes/Remove.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Classes/Service/PublishingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function publishWorkspace(ContentRepository $contentRepository, Workspace
)->block();

$contentRepository->handle(
new PublishWorkspace(
PublishWorkspace::create(
$workspaceName
)
)->block();
Expand Down
Loading