From b0fbcbdcbb00a84656a5e55f06b380ade566428b Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:45:55 +0100 Subject: [PATCH] TASK: Move `moveNodeStrategy` to Neos UI --- Classes/Domain/Model/Changes/MoveAfter.php | 2 +- Classes/Domain/Model/Changes/MoveBefore.php | 2 +- Classes/Domain/Model/Changes/MoveInto.php | 2 +- Configuration/NodeTypes.yaml | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Classes/Domain/Model/Changes/MoveAfter.php b/Classes/Domain/Model/Changes/MoveAfter.php index f50c25d33e..420644702c 100644 --- a/Classes/Domain/Model/Changes/MoveAfter.php +++ b/Classes/Domain/Model/Changes/MoveAfter.php @@ -75,7 +75,7 @@ public function apply(): void $contentRepository = $this->contentRepositoryRegistry->get($subject->contentRepositoryId); $nodeType = $contentRepository->getNodeTypeManager()->getNodeType($this->subject->nodeTypeName); $strategy = $nodeType->getConfiguration('options.moveNodeStrategy') ?: throw new \RuntimeException('Nodetype is missing required option "moveNodeStrategy".', 1645577794); - $strategy = RelationDistributionStrategy::fromName($strategy) ?: throw new \RuntimeException('Nodetype has an invalid configuration for option "moveNodeStrategy".', 1645577794);; + $strategy = RelationDistributionStrategy::tryFrom($strategy) ?? throw new \RuntimeException('Nodetype has an invalid configuration for option "moveNodeStrategy".', 1645577794);; $command = MoveNodeAggregate::create( $subject->workspaceName, $subject->dimensionSpacePoint, diff --git a/Classes/Domain/Model/Changes/MoveBefore.php b/Classes/Domain/Model/Changes/MoveBefore.php index 14a5176533..0a57fa693e 100644 --- a/Classes/Domain/Model/Changes/MoveBefore.php +++ b/Classes/Domain/Model/Changes/MoveBefore.php @@ -70,7 +70,7 @@ public function apply(): void $contentRepository = $this->contentRepositoryRegistry->get($subject->contentRepositoryId); $nodeType = $contentRepository->getNodeTypeManager()->getNodeType($this->subject->nodeTypeName); $strategy = $nodeType->getConfiguration('options.moveNodeStrategy') ?: throw new \RuntimeException('Nodetype is missing required option "moveNodeStrategy".', 1645577794); - $strategy = RelationDistributionStrategy::fromName($strategy) ?: throw new \RuntimeException('Nodetype has an invalid configuration for option "moveNodeStrategy".', 1645577794); + $strategy = RelationDistributionStrategy::tryFrom($strategy) ?? throw new \RuntimeException('Nodetype has an invalid configuration for option "moveNodeStrategy".', 1645577794); $contentRepository->handle( MoveNodeAggregate::create( $subject->workspaceName, diff --git a/Classes/Domain/Model/Changes/MoveInto.php b/Classes/Domain/Model/Changes/MoveInto.php index 6c9008edb3..fe2757751a 100644 --- a/Classes/Domain/Model/Changes/MoveInto.php +++ b/Classes/Domain/Model/Changes/MoveInto.php @@ -80,7 +80,7 @@ public function apply(): void $contentRepository = $this->contentRepositoryRegistry->get($subject->contentRepositoryId); $nodeType = $contentRepository->getNodeTypeManager()->getNodeType($this->subject->nodeTypeName); $strategy = $nodeType->getConfiguration('options.moveNodeStrategy') ?: throw new \RuntimeException('Nodetype is missing required option "moveNodeStrategy".', 1645577794); - $strategy = RelationDistributionStrategy::fromName($strategy) ?: throw new \RuntimeException('Nodetype has an invalid configuration for option "moveNodeStrategy".', 1645577794); + $strategy = RelationDistributionStrategy::tryFrom($strategy) ?? throw new \RuntimeException('Nodetype has an invalid configuration for option "moveNodeStrategy".', 1645577794); $contentRepository->handle( MoveNodeAggregate::create( $subject->workspaceName, diff --git a/Configuration/NodeTypes.yaml b/Configuration/NodeTypes.yaml index d8d0c108ae..16968ddde1 100644 --- a/Configuration/NodeTypes.yaml +++ b/Configuration/NodeTypes.yaml @@ -24,6 +24,7 @@ factoryClassName: 'Neos\Neos\Ui\Infrastructure\Neos\UriPathSegmentNodeCreationHandlerFactory' promotedElements: factoryClassName: 'Neos\Neos\Ui\Infrastructure\ContentRepository\CreationDialog\PromotedElementsCreationHandlerFactory' + moveNodeStrategy: gatherAll 'Neos.Neos:Content': postprocessors: @@ -34,6 +35,7 @@ nodeCreationHandlers: promotedElements: factoryClassName: 'Neos\Neos\Ui\Infrastructure\ContentRepository\CreationDialog\PromotedElementsCreationHandlerFactory' + moveNodeStrategy: scatter 'Neos.Neos:ContentCollection': ui: