From b4306d2caedb4b1d2fbcb3bd92b11e64a5c84f54 Mon Sep 17 00:00:00 2001 From: Paula Kallert Date: Wed, 23 Oct 2024 06:59:22 +0200 Subject: [PATCH 01/15] Feature: Add nodeMove strategy configuration to nodetypes --- .../NodeMove/Command/MoveNodeAggregate.php | 23 +++++++++++++++---- .../Dto/RelationDistributionStrategy.php | 11 +++++++++ .../Classes/Feature/NodeMove/NodeMove.php | 17 ++++++++++---- .../Classes/NodeType/NodeType.php | 10 ++++++++ Neos.Neos/NodeTypes/Mixin/Content.yaml | 2 ++ Neos.Neos/NodeTypes/Mixin/Document.yaml | 2 ++ 6 files changed, 56 insertions(+), 9 deletions(-) diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php index 3a756163488..57faf2d5c47 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php @@ -61,7 +61,7 @@ private function __construct( public WorkspaceName $workspaceName, public DimensionSpacePoint $dimensionSpacePoint, public NodeAggregateId $nodeAggregateId, - public RelationDistributionStrategy $relationDistributionStrategy, + public ?RelationDistributionStrategy $relationDistributionStrategy, public ?NodeAggregateId $newParentNodeAggregateId, public ?NodeAggregateId $newPrecedingSiblingNodeAggregateId, public ?NodeAggregateId $newSucceedingSiblingNodeAggregateId, @@ -72,12 +72,12 @@ private function __construct( * @param WorkspaceName $workspaceName The workspace in which the move operation is to be performed * @param DimensionSpacePoint $dimensionSpacePoint This is one of the *covered* dimension space points of the node aggregate and not necessarily one of the occupied ones. This allows us to move virtual specializations only when using the scatter strategy * @param NodeAggregateId $nodeAggregateId The id of the node aggregate to move - * @param RelationDistributionStrategy $relationDistributionStrategy The relation distribution strategy to be used ({@see RelationDistributionStrategy}) + * @param RelationDistributionStrategy|null $relationDistributionStrategy The relation distribution strategy to be used ({@see RelationDistributionStrategy}) * @param NodeAggregateId|null $newParentNodeAggregateId The id of the new parent node aggregate. If given, it enforces that all nodes in the given aggregate are moved into nodes of the parent aggregate, even if the given siblings belong to other parents. In latter case, those siblings are ignored * @param NodeAggregateId|null $newPrecedingSiblingNodeAggregateId The id of the new preceding sibling node aggregate. If given and no successor found, it is attempted to insert the moved nodes right after nodes of this aggregate. In dimension space points this aggregate does not cover, other siblings, in order of proximity, are tried to be used instead * @param NodeAggregateId|null $newSucceedingSiblingNodeAggregateId The id of the new succeeding sibling node aggregate. If given, it is attempted to insert the moved nodes right before nodes of this aggregate. In dimension space points this aggregate does not cover, the preceding sibling is tried to be used instead */ - public static function create(WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $nodeAggregateId, RelationDistributionStrategy $relationDistributionStrategy, ?NodeAggregateId $newParentNodeAggregateId = null, ?NodeAggregateId $newPrecedingSiblingNodeAggregateId = null, ?NodeAggregateId $newSucceedingSiblingNodeAggregateId = null): self + public static function create(WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $nodeAggregateId, ?RelationDistributionStrategy $relationDistributionStrategy = null, ?NodeAggregateId $newParentNodeAggregateId = null, ?NodeAggregateId $newPrecedingSiblingNodeAggregateId = null, ?NodeAggregateId $newSucceedingSiblingNodeAggregateId = null): self { return new self($workspaceName, $dimensionSpacePoint, $nodeAggregateId, $relationDistributionStrategy, $newParentNodeAggregateId, $newPrecedingSiblingNodeAggregateId, $newSucceedingSiblingNodeAggregateId); } @@ -91,7 +91,9 @@ public static function fromArray(array $array): self WorkspaceName::fromString($array['workspaceName']), DimensionSpacePoint::fromArray($array['dimensionSpacePoint']), NodeAggregateId::fromString($array['nodeAggregateId']), - RelationDistributionStrategy::fromString($array['relationDistributionStrategy']), + isset($array['relationDistributionStrategy']) + ? RelationDistributionStrategy::fromString($array['relationDistributionStrategy']) + : null, isset($array['newParentNodeAggregateId']) ? NodeAggregateId::fromString($array['newParentNodeAggregateId']) : null, @@ -118,6 +120,19 @@ public function matchesNodeId(NodeIdToPublishOrDiscard $nodeIdToPublish): bool && $this->dimensionSpacePoint === $nodeIdToPublish->dimensionSpacePoint; } + public function withRelationDistributionStrategy(RelationDistributionStrategy $relationDistributionStrategy): self + { + return new self( + $this->workspaceName, + $this->dimensionSpacePoint, + $this->nodeAggregateId, + $relationDistributionStrategy, + $this->newParentNodeAggregateId, + $this->newPrecedingSiblingNodeAggregateId, + $this->newSucceedingSiblingNodeAggregateId + ); + } + public function createCopyForWorkspace( WorkspaceName $targetWorkspaceName, ): self { diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php index 7b01ee90ce6..1e1fa3156f5 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php @@ -41,6 +41,17 @@ public static function fromString(?string $serialization): self : self::STRATEGY_GATHER_ALL; } + public static function fromName(string $name): self + { + $name = substr($name, strpos($name, '::') + 2); + foreach (self::cases() as $status) { + if( $name === $status->name ){ + return $status; + } + } + return self::STRATEGY_GATHER_ALL; + } + public function jsonSerialize(): string { return $this->value; diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php index 6dc6c947dc9..05c65f7d211 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php @@ -95,6 +95,12 @@ private function handleMoveNodeAggregate( $contentGraph, $command->nodeAggregateId, ); + + if ($command->relationDistributionStrategy === null) { + $nodeType = $this->nodeTypeManager->getNodeType($nodeAggregate->nodeTypeName); + $command = $command->withRelationDistributionStrategy($nodeType->getMoveNodeRelationDistributionStrategy()); + } + $this->requireNodeAggregateToNotBeRoot($nodeAggregate); $this->requireNodeAggregateToBeUntethered($nodeAggregate); $this->requireNodeAggregateToCoverDimensionSpacePoint($nodeAggregate, $command->dimensionSpacePoint); @@ -125,11 +131,12 @@ private function handleMoveNodeAggregate( if ($nodeAggregate->nodeName) { $this->requireNodeTypeNotToDeclareTetheredChildNodeName($newParentNodeAggregate->nodeTypeName, $nodeAggregate->nodeName); } - - $this->requireNodeAggregateToCoverDimensionSpacePoints( - $newParentNodeAggregate, - $affectedDimensionSpacePoints - ); + if($command->relationDistributionStrategy !== RelationDistributionStrategy::STRATEGY_SCATTER){ + $this->requireNodeAggregateToCoverDimensionSpacePoints( + $newParentNodeAggregate, + $affectedDimensionSpacePoints + ); + } $this->requireNodeAggregateToNotBeDescendant( $contentGraph, diff --git a/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php b/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php index 77c3e27fbfa..4578b079ea6 100644 --- a/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php +++ b/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php @@ -14,6 +14,7 @@ * source code. */ +use Neos\ContentRepository\Core\Feature\NodeMove\Dto\RelationDistributionStrategy; use Neos\ContentRepository\Core\SharedModel\Exception\InvalidNodeTypePostprocessorException; use Neos\ContentRepository\Core\SharedModel\Exception\NodeConfigurationException; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; @@ -543,4 +544,13 @@ protected function setFullConfiguration(array $fullConfiguration): void { $this->fullConfiguration = $fullConfiguration; } + + /** + * Get the MoveNode strategy used when moving a node + */ + public function getMoveNodeRelationDistributionStrategy(): RelationDistributionStrategy + { + $strategy = $this->getConfiguration('strategy.moveNode') ?: 'RelationDistributionStrategy::STRATEGY_GATHER_ALL'; + return RelationDistributionStrategy::fromName($strategy); + } } diff --git a/Neos.Neos/NodeTypes/Mixin/Content.yaml b/Neos.Neos/NodeTypes/Mixin/Content.yaml index 146c402c141..e6b65a4c2d4 100644 --- a/Neos.Neos/NodeTypes/Mixin/Content.yaml +++ b/Neos.Neos/NodeTypes/Mixin/Content.yaml @@ -3,6 +3,8 @@ 'Neos.Neos:Node': true 'Neos.Neos:Hidable': true abstract: true + strategy: + moveNode: RelationDistributionStrategy::STRATEGY_SCATTER constraints: nodeTypes: '*': false diff --git a/Neos.Neos/NodeTypes/Mixin/Document.yaml b/Neos.Neos/NodeTypes/Mixin/Document.yaml index c3277bf4344..87a43e005fb 100644 --- a/Neos.Neos/NodeTypes/Mixin/Document.yaml +++ b/Neos.Neos/NodeTypes/Mixin/Document.yaml @@ -7,6 +7,8 @@ 'Neos.Neos:Hidable': true abstract: true aggregate: true + strategy: + moveNode: RelationDistributionStrategy::STRATEGY_GATHER_ALL constraints: nodeTypes: '*': false From 182808a0d1815a64e7fa0950701efc8883601369 Mon Sep 17 00:00:00 2001 From: Paula Kallert Date: Wed, 23 Oct 2024 10:25:05 +0200 Subject: [PATCH 02/15] Feature: linting --- .../Feature/NodeMove/Dto/RelationDistributionStrategy.php | 2 +- .../Classes/Feature/NodeMove/NodeMove.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php index 1e1fa3156f5..ea0016a5e7a 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php @@ -45,7 +45,7 @@ public static function fromName(string $name): self { $name = substr($name, strpos($name, '::') + 2); foreach (self::cases() as $status) { - if( $name === $status->name ){ + if ($name === $status->name) { return $status; } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php index 05c65f7d211..17f663a8534 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php @@ -131,7 +131,7 @@ private function handleMoveNodeAggregate( if ($nodeAggregate->nodeName) { $this->requireNodeTypeNotToDeclareTetheredChildNodeName($newParentNodeAggregate->nodeTypeName, $nodeAggregate->nodeName); } - if($command->relationDistributionStrategy !== RelationDistributionStrategy::STRATEGY_SCATTER){ + if ($command->relationDistributionStrategy !== RelationDistributionStrategy::STRATEGY_SCATTER) { $this->requireNodeAggregateToCoverDimensionSpacePoints( $newParentNodeAggregate, $affectedDimensionSpacePoints From 26da299fe214719201d2e4a1c757c9d70357d982 Mon Sep 17 00:00:00 2001 From: pKallert <91674611+pKallert@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:16:38 +0200 Subject: [PATCH 03/15] Fjx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sebastian Kurfürst --- .../Classes/Feature/NodeMove/Command/MoveNodeAggregate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php index 57faf2d5c47..24fcc67eddc 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php @@ -72,7 +72,7 @@ private function __construct( * @param WorkspaceName $workspaceName The workspace in which the move operation is to be performed * @param DimensionSpacePoint $dimensionSpacePoint This is one of the *covered* dimension space points of the node aggregate and not necessarily one of the occupied ones. This allows us to move virtual specializations only when using the scatter strategy * @param NodeAggregateId $nodeAggregateId The id of the node aggregate to move - * @param RelationDistributionStrategy|null $relationDistributionStrategy The relation distribution strategy to be used ({@see RelationDistributionStrategy}) + * @param RelationDistributionStrategy|null $relationDistributionStrategy The relation distribution strategy to be used ({@see RelationDistributionStrategy}). If not specified, is read from NodeTypes.yaml (strategy.moveNode) * @param NodeAggregateId|null $newParentNodeAggregateId The id of the new parent node aggregate. If given, it enforces that all nodes in the given aggregate are moved into nodes of the parent aggregate, even if the given siblings belong to other parents. In latter case, those siblings are ignored * @param NodeAggregateId|null $newPrecedingSiblingNodeAggregateId The id of the new preceding sibling node aggregate. If given and no successor found, it is attempted to insert the moved nodes right after nodes of this aggregate. In dimension space points this aggregate does not cover, other siblings, in order of proximity, are tried to be used instead * @param NodeAggregateId|null $newSucceedingSiblingNodeAggregateId The id of the new succeeding sibling node aggregate. If given, it is attempted to insert the moved nodes right before nodes of this aggregate. In dimension space points this aggregate does not cover, the preceding sibling is tried to be used instead From b63f93bbea2dc71fbe62fcd9cacbd83596c439cf Mon Sep 17 00:00:00 2001 From: Paula Kallert Date: Wed, 23 Oct 2024 11:20:15 +0200 Subject: [PATCH 04/15] Feature: check if setting has right class --- .../NodeMove/Dto/RelationDistributionStrategy.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php index ea0016a5e7a..17ad77adf7b 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php @@ -43,10 +43,12 @@ public static function fromString(?string $serialization): self public static function fromName(string $name): self { - $name = substr($name, strpos($name, '::') + 2); - foreach (self::cases() as $status) { - if ($name === $status->name) { - return $status; + if (str_starts_with($name, 'RelationDistributionStrategy::')) { + $name = substr($name, strpos($name, '::') + 2); + foreach (self::cases() as $status) { + if ($name === $status->name) { + return $status; + } } } return self::STRATEGY_GATHER_ALL; From 3529326ec9f97305eaece009d903d89f0d6604a6 Mon Sep 17 00:00:00 2001 From: Paula Kallert Date: Wed, 23 Oct 2024 11:27:23 +0200 Subject: [PATCH 05/15] Fix: make relationDistributionStrategy nullable --- .../Classes/Feature/NodeMove/NodeMove.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php index 17f663a8534..10f6172a7d2 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php @@ -224,7 +224,7 @@ private function handleMoveNodeAggregate( private function resolveAffectedDimensionSpacePointSet( NodeAggregate $nodeAggregate, - Dto\RelationDistributionStrategy $relationDistributionStrategy, + ?Dto\RelationDistributionStrategy $relationDistributionStrategy, DimensionSpace\DimensionSpacePoint $referenceDimensionSpacePoint ): DimensionSpacePointSet { return match ($relationDistributionStrategy) { From dd628622e4b5700080150aae87f030e439bd83a6 Mon Sep 17 00:00:00 2001 From: Paula Kallert Date: Wed, 23 Oct 2024 11:36:50 +0200 Subject: [PATCH 06/15] Feature: Allow nullable nodetype --- .../Classes/Feature/NodeMove/NodeMove.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php index 10f6172a7d2..213d7cdc729 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php @@ -98,7 +98,7 @@ private function handleMoveNodeAggregate( if ($command->relationDistributionStrategy === null) { $nodeType = $this->nodeTypeManager->getNodeType($nodeAggregate->nodeTypeName); - $command = $command->withRelationDistributionStrategy($nodeType->getMoveNodeRelationDistributionStrategy()); + $command = $command->withRelationDistributionStrategy($nodeType->getMoveNodeRelationDistributionStrategy() ?: RelationDistributionStrategy::STRATEGY_GATHER_ALL); } $this->requireNodeAggregateToNotBeRoot($nodeAggregate); From 43d4d8595d10b19b0ab497216ed5267fc9fe0c7d Mon Sep 17 00:00:00 2001 From: Paula Kallert Date: Wed, 23 Oct 2024 11:43:39 +0200 Subject: [PATCH 07/15] Fix: make relationDistributionStrategy nullable --- .../Classes/Feature/NodeMove/NodeMove.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php index 213d7cdc729..2008e513129 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php @@ -98,7 +98,10 @@ private function handleMoveNodeAggregate( if ($command->relationDistributionStrategy === null) { $nodeType = $this->nodeTypeManager->getNodeType($nodeAggregate->nodeTypeName); - $command = $command->withRelationDistributionStrategy($nodeType->getMoveNodeRelationDistributionStrategy() ?: RelationDistributionStrategy::STRATEGY_GATHER_ALL); + $command = $command->withRelationDistributionStrategy( + $nodeType ? + $nodeType->getMoveNodeRelationDistributionStrategy() : + RelationDistributionStrategy::STRATEGY_GATHER_ALL); } $this->requireNodeAggregateToNotBeRoot($nodeAggregate); From 4096cf9e03b6a1676e136acb03e95371660cf723 Mon Sep 17 00:00:00 2001 From: Paula Kallert Date: Wed, 23 Oct 2024 11:51:19 +0200 Subject: [PATCH 08/15] Feature: linting --- .../Classes/Feature/NodeMove/NodeMove.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php index 2008e513129..a4325261a6d 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php @@ -99,9 +99,8 @@ private function handleMoveNodeAggregate( if ($command->relationDistributionStrategy === null) { $nodeType = $this->nodeTypeManager->getNodeType($nodeAggregate->nodeTypeName); $command = $command->withRelationDistributionStrategy( - $nodeType ? - $nodeType->getMoveNodeRelationDistributionStrategy() : - RelationDistributionStrategy::STRATEGY_GATHER_ALL); + $nodeType ? $nodeType->getMoveNodeRelationDistributionStrategy() : RelationDistributionStrategy::STRATEGY_GATHER_ALL + ); } $this->requireNodeAggregateToNotBeRoot($nodeAggregate); From 6f11943e5c10da6ff8b1a718def7f6d6d214d535 Mon Sep 17 00:00:00 2001 From: Paula Kallert Date: Wed, 23 Oct 2024 12:03:23 +0200 Subject: [PATCH 09/15] Feature: Adjust NodeTypesSchema --- .../Resources/Private/Schema/NodeTypes.schema.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Neos.ContentRepositoryRegistry/Resources/Private/Schema/NodeTypes.schema.yaml b/Neos.ContentRepositoryRegistry/Resources/Private/Schema/NodeTypes.schema.yaml index 1903649845f..3b54d41db00 100644 --- a/Neos.ContentRepositoryRegistry/Resources/Private/Schema/NodeTypes.schema.yaml +++ b/Neos.ContentRepositoryRegistry/Resources/Private/Schema/NodeTypes.schema.yaml @@ -9,6 +9,12 @@ additionalProperties: 'final': { type: boolean, description: "If final, this node type cannot be subclassed" } 'aggregate': { type: boolean, description: "INTERNAL. If aggregate, this node type is something like a Document. If not aggregate, it is seen as part of an aggregate node type - has influence on how e.g. moving of nodes across dimensions work." } + 'strategy': + type: dictionary + additionalProperties: false + properties: + 'nodeMove': { type: string, description: "Strategy for moving nodes of this type" } + 'superTypes': type: dictionary description: "List of Content Repository Node Types which are supertypes of this type" From b4b0192fa25298ba8ad2d01a35fa2a8ba999b378 Mon Sep 17 00:00:00 2001 From: Paula Kallert Date: Wed, 23 Oct 2024 12:16:47 +0200 Subject: [PATCH 10/15] Feature: Adjust Node Schema --- .../Resources/Private/Schema/NodeTypes.schema.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/Neos.ContentRepositoryRegistry/Resources/Private/Schema/NodeTypes.schema.yaml b/Neos.ContentRepositoryRegistry/Resources/Private/Schema/NodeTypes.schema.yaml index 3b54d41db00..c47c4541a2b 100644 --- a/Neos.ContentRepositoryRegistry/Resources/Private/Schema/NodeTypes.schema.yaml +++ b/Neos.ContentRepositoryRegistry/Resources/Private/Schema/NodeTypes.schema.yaml @@ -11,7 +11,6 @@ additionalProperties: 'strategy': type: dictionary - additionalProperties: false properties: 'nodeMove': { type: string, description: "Strategy for moving nodes of this type" } From b3c708e6400f14820a725a1a8281f0159b1f6753 Mon Sep 17 00:00:00 2001 From: Paula Kallert Date: Wed, 13 Nov 2024 15:39:57 +0100 Subject: [PATCH 11/15] Fix: require NodeAggregateToCoverDimensionSpacePoints also for strategy scatter --- .../Classes/Feature/NodeMove/NodeMove.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php index 20f051e8366..757286e8243 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php @@ -133,12 +133,11 @@ private function handleMoveNodeAggregate( if ($nodeAggregate->nodeName) { $this->requireNodeTypeNotToDeclareTetheredChildNodeName($newParentNodeAggregate->nodeTypeName, $nodeAggregate->nodeName); } - if ($command->relationDistributionStrategy !== RelationDistributionStrategy::STRATEGY_SCATTER) { - $this->requireNodeAggregateToCoverDimensionSpacePoints( - $newParentNodeAggregate, - $affectedDimensionSpacePoints - ); - } + + $this->requireNodeAggregateToCoverDimensionSpacePoints( + $newParentNodeAggregate, + $affectedDimensionSpacePoints + ); $this->requireNodeAggregateToNotBeDescendant( $contentGraph, From 335bc3334f32f14cf77755e7abb1e241c9c49103 Mon Sep 17 00:00:00 2001 From: Paula Kallert Date: Fri, 15 Nov 2024 07:26:56 +0100 Subject: [PATCH 12/15] Feature: Remove NodeMove logic from Neos.Neos --- .../NodeMove/Command/MoveNodeAggregate.php | 23 +++----------- .../Dto/RelationDistributionStrategy.php | 13 ++++---- .../Classes/Feature/NodeMove/NodeMove.php | 9 +----- .../Classes/NodeType/NodeType.php | 9 ------ .../Exception/NodeTypeHasInvalidSetting.php | 30 +++++++++++++++++++ .../Private/Schema/NodeTypes.schema.yaml | 6 ---- Neos.Neos/NodeTypes/Mixin/Content.yaml | 4 +-- Neos.Neos/NodeTypes/Mixin/Document.yaml | 5 ++-- 8 files changed, 44 insertions(+), 55 deletions(-) create mode 100644 Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeTypeHasInvalidSetting.php diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php index 24fcc67eddc..36387690d41 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php @@ -61,7 +61,7 @@ private function __construct( public WorkspaceName $workspaceName, public DimensionSpacePoint $dimensionSpacePoint, public NodeAggregateId $nodeAggregateId, - public ?RelationDistributionStrategy $relationDistributionStrategy, + public RelationDistributionStrategy $relationDistributionStrategy, public ?NodeAggregateId $newParentNodeAggregateId, public ?NodeAggregateId $newPrecedingSiblingNodeAggregateId, public ?NodeAggregateId $newSucceedingSiblingNodeAggregateId, @@ -72,12 +72,12 @@ private function __construct( * @param WorkspaceName $workspaceName The workspace in which the move operation is to be performed * @param DimensionSpacePoint $dimensionSpacePoint This is one of the *covered* dimension space points of the node aggregate and not necessarily one of the occupied ones. This allows us to move virtual specializations only when using the scatter strategy * @param NodeAggregateId $nodeAggregateId The id of the node aggregate to move - * @param RelationDistributionStrategy|null $relationDistributionStrategy The relation distribution strategy to be used ({@see RelationDistributionStrategy}). If not specified, is read from NodeTypes.yaml (strategy.moveNode) + * @param RelationDistributionStrategy|null $relationDistributionStrategy The relation distribution strategy to be used ({@see RelationDistributionStrategy}). * @param NodeAggregateId|null $newParentNodeAggregateId The id of the new parent node aggregate. If given, it enforces that all nodes in the given aggregate are moved into nodes of the parent aggregate, even if the given siblings belong to other parents. In latter case, those siblings are ignored * @param NodeAggregateId|null $newPrecedingSiblingNodeAggregateId The id of the new preceding sibling node aggregate. If given and no successor found, it is attempted to insert the moved nodes right after nodes of this aggregate. In dimension space points this aggregate does not cover, other siblings, in order of proximity, are tried to be used instead * @param NodeAggregateId|null $newSucceedingSiblingNodeAggregateId The id of the new succeeding sibling node aggregate. If given, it is attempted to insert the moved nodes right before nodes of this aggregate. In dimension space points this aggregate does not cover, the preceding sibling is tried to be used instead */ - public static function create(WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $nodeAggregateId, ?RelationDistributionStrategy $relationDistributionStrategy = null, ?NodeAggregateId $newParentNodeAggregateId = null, ?NodeAggregateId $newPrecedingSiblingNodeAggregateId = null, ?NodeAggregateId $newSucceedingSiblingNodeAggregateId = null): self + public static function create(WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $nodeAggregateId, ?RelationDistributionStrategy $relationDistributionStrategy, ?NodeAggregateId $newParentNodeAggregateId = null, ?NodeAggregateId $newPrecedingSiblingNodeAggregateId = null, ?NodeAggregateId $newSucceedingSiblingNodeAggregateId = null): self { return new self($workspaceName, $dimensionSpacePoint, $nodeAggregateId, $relationDistributionStrategy, $newParentNodeAggregateId, $newPrecedingSiblingNodeAggregateId, $newSucceedingSiblingNodeAggregateId); } @@ -91,9 +91,7 @@ public static function fromArray(array $array): self WorkspaceName::fromString($array['workspaceName']), DimensionSpacePoint::fromArray($array['dimensionSpacePoint']), NodeAggregateId::fromString($array['nodeAggregateId']), - isset($array['relationDistributionStrategy']) - ? RelationDistributionStrategy::fromString($array['relationDistributionStrategy']) - : null, + RelationDistributionStrategy::fromString($array['relationDistributionStrategy']), isset($array['newParentNodeAggregateId']) ? NodeAggregateId::fromString($array['newParentNodeAggregateId']) : null, @@ -120,19 +118,6 @@ public function matchesNodeId(NodeIdToPublishOrDiscard $nodeIdToPublish): bool && $this->dimensionSpacePoint === $nodeIdToPublish->dimensionSpacePoint; } - public function withRelationDistributionStrategy(RelationDistributionStrategy $relationDistributionStrategy): self - { - return new self( - $this->workspaceName, - $this->dimensionSpacePoint, - $this->nodeAggregateId, - $relationDistributionStrategy, - $this->newParentNodeAggregateId, - $this->newPrecedingSiblingNodeAggregateId, - $this->newSucceedingSiblingNodeAggregateId - ); - } - public function createCopyForWorkspace( WorkspaceName $targetWorkspaceName, ): self { diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php index 17ad77adf7b..2863c80ef55 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php @@ -41,17 +41,14 @@ public static function fromString(?string $serialization): self : self::STRATEGY_GATHER_ALL; } - public static function fromName(string $name): self + public static function fromName(string $name): ?self { - if (str_starts_with($name, 'RelationDistributionStrategy::')) { - $name = substr($name, strpos($name, '::') + 2); - foreach (self::cases() as $status) { - if ($name === $status->name) { - return $status; - } + foreach (self::cases() as $status) { + if ($name === $status->name) { + return $status; } } - return self::STRATEGY_GATHER_ALL; + return null; } public function jsonSerialize(): string diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php index 757286e8243..8b6c3f9478b 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php @@ -96,13 +96,6 @@ private function handleMoveNodeAggregate( $command->nodeAggregateId, ); - if ($command->relationDistributionStrategy === null) { - $nodeType = $this->nodeTypeManager->getNodeType($nodeAggregate->nodeTypeName); - $command = $command->withRelationDistributionStrategy( - $nodeType ? $nodeType->getMoveNodeRelationDistributionStrategy() : RelationDistributionStrategy::STRATEGY_GATHER_ALL - ); - } - $this->requireNodeAggregateToNotBeRoot($nodeAggregate); $this->requireNodeAggregateToBeUntethered($nodeAggregate); $this->requireNodeAggregateToCoverDimensionSpacePoint($nodeAggregate, $command->dimensionSpacePoint); @@ -225,7 +218,7 @@ private function handleMoveNodeAggregate( private function resolveAffectedDimensionSpacePointSet( NodeAggregate $nodeAggregate, - ?Dto\RelationDistributionStrategy $relationDistributionStrategy, + Dto\RelationDistributionStrategy $relationDistributionStrategy, DimensionSpace\DimensionSpacePoint $referenceDimensionSpacePoint ): DimensionSpacePointSet { return match ($relationDistributionStrategy) { diff --git a/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php b/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php index 4578b079ea6..b0523c3bcd5 100644 --- a/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php +++ b/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php @@ -544,13 +544,4 @@ protected function setFullConfiguration(array $fullConfiguration): void { $this->fullConfiguration = $fullConfiguration; } - - /** - * Get the MoveNode strategy used when moving a node - */ - public function getMoveNodeRelationDistributionStrategy(): RelationDistributionStrategy - { - $strategy = $this->getConfiguration('strategy.moveNode') ?: 'RelationDistributionStrategy::STRATEGY_GATHER_ALL'; - return RelationDistributionStrategy::fromName($strategy); - } } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeTypeHasInvalidSetting.php b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeTypeHasInvalidSetting.php new file mode 100644 index 00000000000..0b776b37d12 --- /dev/null +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeTypeHasInvalidSetting.php @@ -0,0 +1,30 @@ +value . '" has no valid setting for "' . $setting . '"', 1630061720); + } +} diff --git a/Neos.ContentRepositoryRegistry/Resources/Private/Schema/NodeTypes.schema.yaml b/Neos.ContentRepositoryRegistry/Resources/Private/Schema/NodeTypes.schema.yaml index c47c4541a2b..bdeececdb70 100644 --- a/Neos.ContentRepositoryRegistry/Resources/Private/Schema/NodeTypes.schema.yaml +++ b/Neos.ContentRepositoryRegistry/Resources/Private/Schema/NodeTypes.schema.yaml @@ -7,12 +7,6 @@ additionalProperties: 'class': { type: string, format: class-name } 'abstract': { type: boolean, description: "Abstract node type for default/mixin usage" } 'final': { type: boolean, description: "If final, this node type cannot be subclassed" } - 'aggregate': { type: boolean, description: "INTERNAL. If aggregate, this node type is something like a Document. If not aggregate, it is seen as part of an aggregate node type - has influence on how e.g. moving of nodes across dimensions work." } - - 'strategy': - type: dictionary - properties: - 'nodeMove': { type: string, description: "Strategy for moving nodes of this type" } 'superTypes': type: dictionary diff --git a/Neos.Neos/NodeTypes/Mixin/Content.yaml b/Neos.Neos/NodeTypes/Mixin/Content.yaml index e6b65a4c2d4..b62eb7f9b82 100644 --- a/Neos.Neos/NodeTypes/Mixin/Content.yaml +++ b/Neos.Neos/NodeTypes/Mixin/Content.yaml @@ -3,8 +3,6 @@ 'Neos.Neos:Node': true 'Neos.Neos:Hidable': true abstract: true - strategy: - moveNode: RelationDistributionStrategy::STRATEGY_SCATTER constraints: nodeTypes: '*': false @@ -26,3 +24,5 @@ inspector: editorOptions: baseNodeType: 'Neos.Neos:Content' + options: + moveNodeStrategy: STRATEGY_SCATTER diff --git a/Neos.Neos/NodeTypes/Mixin/Document.yaml b/Neos.Neos/NodeTypes/Mixin/Document.yaml index 87a43e005fb..5542eebf482 100644 --- a/Neos.Neos/NodeTypes/Mixin/Document.yaml +++ b/Neos.Neos/NodeTypes/Mixin/Document.yaml @@ -6,9 +6,6 @@ 'Neos.Neos:Node': true 'Neos.Neos:Hidable': true abstract: true - aggregate: true - strategy: - moveNode: RelationDistributionStrategy::STRATEGY_GATHER_ALL constraints: nodeTypes: '*': false @@ -69,3 +66,5 @@ inspector: group: 'visibility' position: 40 + options: + nodeMoveStrategy: STRATEGY_GATHER_ALL From 74dab5b7c1ca1b530d4655f967283c97766246c5 Mon Sep 17 00:00:00 2001 From: Paula Kallert Date: Fri, 15 Nov 2024 07:30:13 +0100 Subject: [PATCH 13/15] Fix: Undo more changes in Core --- .../NodeMove/Command/MoveNodeAggregate.php | 4 +-- .../Classes/Feature/NodeMove/NodeMove.php | 1 - .../Classes/NodeType/NodeType.php | 1 - .../Exception/NodeTypeHasInvalidSetting.php | 30 ------------------- Neos.Neos/NodeTypes/Mixin/Document.yaml | 2 +- 5 files changed, 3 insertions(+), 35 deletions(-) delete mode 100644 Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeTypeHasInvalidSetting.php diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php index 36387690d41..5be76d68b56 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Command/MoveNodeAggregate.php @@ -72,12 +72,12 @@ private function __construct( * @param WorkspaceName $workspaceName The workspace in which the move operation is to be performed * @param DimensionSpacePoint $dimensionSpacePoint This is one of the *covered* dimension space points of the node aggregate and not necessarily one of the occupied ones. This allows us to move virtual specializations only when using the scatter strategy * @param NodeAggregateId $nodeAggregateId The id of the node aggregate to move - * @param RelationDistributionStrategy|null $relationDistributionStrategy The relation distribution strategy to be used ({@see RelationDistributionStrategy}). + * @param RelationDistributionStrategy $relationDistributionStrategy The relation distribution strategy to be used ({@see RelationDistributionStrategy}). * @param NodeAggregateId|null $newParentNodeAggregateId The id of the new parent node aggregate. If given, it enforces that all nodes in the given aggregate are moved into nodes of the parent aggregate, even if the given siblings belong to other parents. In latter case, those siblings are ignored * @param NodeAggregateId|null $newPrecedingSiblingNodeAggregateId The id of the new preceding sibling node aggregate. If given and no successor found, it is attempted to insert the moved nodes right after nodes of this aggregate. In dimension space points this aggregate does not cover, other siblings, in order of proximity, are tried to be used instead * @param NodeAggregateId|null $newSucceedingSiblingNodeAggregateId The id of the new succeeding sibling node aggregate. If given, it is attempted to insert the moved nodes right before nodes of this aggregate. In dimension space points this aggregate does not cover, the preceding sibling is tried to be used instead */ - public static function create(WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $nodeAggregateId, ?RelationDistributionStrategy $relationDistributionStrategy, ?NodeAggregateId $newParentNodeAggregateId = null, ?NodeAggregateId $newPrecedingSiblingNodeAggregateId = null, ?NodeAggregateId $newSucceedingSiblingNodeAggregateId = null): self + public static function create(WorkspaceName $workspaceName, DimensionSpacePoint $dimensionSpacePoint, NodeAggregateId $nodeAggregateId, RelationDistributionStrategy $relationDistributionStrategy, ?NodeAggregateId $newParentNodeAggregateId = null, ?NodeAggregateId $newPrecedingSiblingNodeAggregateId = null, ?NodeAggregateId $newSucceedingSiblingNodeAggregateId = null): self { return new self($workspaceName, $dimensionSpacePoint, $nodeAggregateId, $relationDistributionStrategy, $newParentNodeAggregateId, $newPrecedingSiblingNodeAggregateId, $newSucceedingSiblingNodeAggregateId); } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php index 8b6c3f9478b..5dfae05275c 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php @@ -95,7 +95,6 @@ private function handleMoveNodeAggregate( $contentGraph, $command->nodeAggregateId, ); - $this->requireNodeAggregateToNotBeRoot($nodeAggregate); $this->requireNodeAggregateToBeUntethered($nodeAggregate); $this->requireNodeAggregateToCoverDimensionSpacePoint($nodeAggregate, $command->dimensionSpacePoint); diff --git a/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php b/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php index b0523c3bcd5..77c3e27fbfa 100644 --- a/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php +++ b/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php @@ -14,7 +14,6 @@ * source code. */ -use Neos\ContentRepository\Core\Feature\NodeMove\Dto\RelationDistributionStrategy; use Neos\ContentRepository\Core\SharedModel\Exception\InvalidNodeTypePostprocessorException; use Neos\ContentRepository\Core\SharedModel\Exception\NodeConfigurationException; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeTypeHasInvalidSetting.php b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeTypeHasInvalidSetting.php deleted file mode 100644 index 0b776b37d12..00000000000 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeTypeHasInvalidSetting.php +++ /dev/null @@ -1,30 +0,0 @@ -value . '" has no valid setting for "' . $setting . '"', 1630061720); - } -} diff --git a/Neos.Neos/NodeTypes/Mixin/Document.yaml b/Neos.Neos/NodeTypes/Mixin/Document.yaml index 5542eebf482..62406b1e95c 100644 --- a/Neos.Neos/NodeTypes/Mixin/Document.yaml +++ b/Neos.Neos/NodeTypes/Mixin/Document.yaml @@ -67,4 +67,4 @@ group: 'visibility' position: 40 options: - nodeMoveStrategy: STRATEGY_GATHER_ALL + moveNodeStrategy: STRATEGY_GATHER_ALL From acc07c879b34f4fc8958626afb19a9cfe56c17c1 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:46:15 +0100 Subject: [PATCH 14/15] TASK: Move `moveNodeStrategy` to Neos UI --- .../NodeMove/Dto/RelationDistributionStrategy.php | 10 ---------- Neos.Neos/NodeTypes/Mixin/Content.yaml | 2 -- Neos.Neos/NodeTypes/Mixin/Document.yaml | 2 -- 3 files changed, 14 deletions(-) diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php index 45213be5116..8ca1fd33f08 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/RelationDistributionStrategy.php @@ -39,16 +39,6 @@ public static function default(): self return self::STRATEGY_GATHER_ALL; } - public static function fromName(string $name): ?self - { - foreach (self::cases() as $status) { - if ($name === $status->name) { - return $status; - } - } - return null; - } - public function jsonSerialize(): string { return $this->value; diff --git a/Neos.Neos/NodeTypes/Mixin/Content.yaml b/Neos.Neos/NodeTypes/Mixin/Content.yaml index b62eb7f9b82..146c402c141 100644 --- a/Neos.Neos/NodeTypes/Mixin/Content.yaml +++ b/Neos.Neos/NodeTypes/Mixin/Content.yaml @@ -24,5 +24,3 @@ inspector: editorOptions: baseNodeType: 'Neos.Neos:Content' - options: - moveNodeStrategy: STRATEGY_SCATTER diff --git a/Neos.Neos/NodeTypes/Mixin/Document.yaml b/Neos.Neos/NodeTypes/Mixin/Document.yaml index 62406b1e95c..c13185e412a 100644 --- a/Neos.Neos/NodeTypes/Mixin/Document.yaml +++ b/Neos.Neos/NodeTypes/Mixin/Document.yaml @@ -66,5 +66,3 @@ inspector: group: 'visibility' position: 40 - options: - moveNodeStrategy: STRATEGY_GATHER_ALL From 56953bdf7a9249e53e2af7965ea82f98c368ed17 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:09:04 +0100 Subject: [PATCH 15/15] TASK: Fully remove `aggregate=true` --- .../Classes/NodeType/NodeType.php | 19 ---------------- .../Unit/NodeType/NodeTypeManagerTest.php | 18 --------------- .../Controller/Service/NodesController.php | 22 ++++--------------- .../References/NodeTypeDefinition.rst | 10 --------- 4 files changed, 4 insertions(+), 65 deletions(-) diff --git a/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php b/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php index 77c3e27fbfa..56e88b3e18e 100644 --- a/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php +++ b/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php @@ -291,25 +291,6 @@ public function getDeclaredSuperTypes(): array }); } - /** - * Returns whether this node type (or any parent type) is an *aggregate*. - * - * The most prominent *aggregate* is a Document and everything which inherits from it, like a Page. - * - * If a node type is marked as aggregate, it means that: - * - * - the node type can "live on its own", i.e. can be part of an external URL - * - when moving this node, all node variants are also moved (across all dimensions) - * - Recursive copying only happens *inside* this aggregate, and stops at nested aggregates. - * - * @return boolean true if the node type is an aggregate - * @api - */ - public function isAggregate(): bool - { - return $this->getConfiguration('aggregate') === true; - } - /** * If this node type or any of the direct or indirect super types * has the given name. diff --git a/Neos.ContentRepository.Core/Tests/Unit/NodeType/NodeTypeManagerTest.php b/Neos.ContentRepository.Core/Tests/Unit/NodeType/NodeTypeManagerTest.php index 578378366ce..965c517754d 100644 --- a/Neos.ContentRepository.Core/Tests/Unit/NodeType/NodeTypeManagerTest.php +++ b/Neos.ContentRepository.Core/Tests/Unit/NodeType/NodeTypeManagerTest.php @@ -114,7 +114,6 @@ protected function prepareNodeTypeManager(array $nodeTypesFixtureData) ], 'Neos.ContentRepository.Testing:Document' => [ 'abstract' => true, - 'aggregate' => true ], 'Neos.ContentRepository.Testing:Page' => [ 'superTypes' => ['Neos.ContentRepository.Testing:Document' => true], @@ -273,23 +272,6 @@ public function getNodeTypeAllowsToRetrieveFinalNodeTypes() self::assertTrue($this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:MyFinalType')->isFinal()); } - /** - * @test - */ - public function aggregateNodeTypeFlagIsFalseByDefault() - { - self::assertFalse($this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Text')->isAggregate()); - } - - /** - * @test - */ - public function aggregateNodeTypeFlagIsInherited() - { - self::assertTrue($this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Document')->isAggregate()); - self::assertTrue($this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Page')->isAggregate()); - } - /** * @test */ diff --git a/Neos.Neos/Classes/Controller/Service/NodesController.php b/Neos.Neos/Classes/Controller/Service/NodesController.php index 5b40ce7ddcf..d2ad504007b 100644 --- a/Neos.Neos/Classes/Controller/Service/NodesController.php +++ b/Neos.Neos/Classes/Controller/Service/NodesController.php @@ -331,17 +331,15 @@ protected function addExistingNodeVariantInformationToResponse( // If the node exists in another dimension, we want to know how many nodes in the rootline are also // missing for the target dimension. This is needed in the UI to tell the user if nodes will be // materialized recursively upwards in the rootline. To find the node path for the given identifier, - // we just use the first result. This is a safe assumption at least for "Document" nodes (aggregate=true), - // because they are always moved in-sync. - if ($nodeTypeManager->getNodeType($nodeAggregate->nodeTypeName)?->isAggregate()) { + // we just use the first result. This is a safe assumption at least for "Document" nodes , + // because they are always moved in-sync by default via (options.moveNodeStrategy=gatherAll). + if ($nodeTypeManager->getNodeType($nodeAggregate->nodeTypeName)?->isOfType(NodeTypeNameFactory::NAME_DOCUMENT)) { // TODO: we would need the SourceDimensions parameter (as in Create()) to ensure the correct // rootline is traversed. Here, we, as a workaround, simply use the 1st aggregate for now. $missingNodesOnRootline = 0; while ( - $parentAggregate = self::firstNodeAggregate( - $contentGraph->findParentNodeAggregates($identifier) - ) + $parentAggregate = $contentGraph->findParentNodeAggregates($identifier)->first() ) { if (!$parentAggregate->coversDimensionSpacePoint($dimensionSpacePoint)) { $missingNodesOnRootline++; @@ -361,18 +359,6 @@ protected function addExistingNodeVariantInformationToResponse( } } - /** - * @param iterable $nodeAggregates - * @return NodeAggregate|null - */ - private static function firstNodeAggregate(iterable $nodeAggregates): ?NodeAggregate - { - foreach ($nodeAggregates as $nodeAggregate) { - return $nodeAggregate; - } - return null; - } - /** * Adopt (translate) the given node and parents that are not yet visible to the given context * diff --git a/Neos.Neos/Documentation/References/NodeTypeDefinition.rst b/Neos.Neos/Documentation/References/NodeTypeDefinition.rst index 0af58d7631d..f7680a41b77 100644 --- a/Neos.Neos/Documentation/References/NodeTypeDefinition.rst +++ b/Neos.Neos/Documentation/References/NodeTypeDefinition.rst @@ -14,16 +14,6 @@ The following options are allowed for defining a NodeType: Abstract node types are useful when using inheritance and composition, so mark base node types and mixins as abstract. -``aggregate`` - A boolean flag, marking a node type as *aggregate*. If a node type is marked as aggregate, it means that: - - - the node type can "live on its own", i.e. can be part of an external URL - - when moving this node, all node variants are also moved (across all dimensions) - - Recursive copying only happens *inside* this aggregate, and stops at nested aggregates. - - The most prominent *aggregate* is `Neos.Neos:Document` and everything which inherits from it, like - `Neos.NodeTypes:Page`. - ``superTypes`` An array of parent node types as keys with a boolean value::