diff --git a/Neos.ContentRepository.Core/Classes/Feature/RebaseableCommands.php b/Neos.ContentRepository.Core/Classes/Feature/RebaseableCommands.php index 48029a0ed5..4d5e6764b4 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/RebaseableCommands.php +++ b/Neos.ContentRepository.Core/Classes/Feature/RebaseableCommands.php @@ -4,7 +4,10 @@ namespace Neos\ContentRepository\Core\Feature; +use Neos\ContentRepository\Core\Feature\Common\EmbedsNodeAggregateId; use Neos\ContentRepository\Core\Feature\Common\RebasableToOtherWorkspaceInterface; +use Neos\ContentRepository\Core\Feature\DimensionSpaceAdjustment\Command\AddDimensionShineThrough; +use Neos\ContentRepository\Core\Feature\DimensionSpaceAdjustment\Command\MoveDimensionSpacePoint; use Neos\ContentRepository\Core\Feature\NodeCreation\Command\CreateNodeAggregateWithNodeAndSerializedProperties; use Neos\ContentRepository\Core\Feature\NodeDisabling\Command\DisableNodeAggregate; use Neos\ContentRepository\Core\Feature\NodeDisabling\Command\EnableNodeAggregate; @@ -16,6 +19,8 @@ use Neos\ContentRepository\Core\Feature\NodeRenaming\Command\ChangeNodeAggregateName; use Neos\ContentRepository\Core\Feature\NodeTypeChange\Command\ChangeNodeAggregateType; use Neos\ContentRepository\Core\Feature\NodeVariation\Command\CreateNodeVariant; +use Neos\ContentRepository\Core\Feature\RootNodeCreation\Command\CreateRootNodeAggregateWithNode; +use Neos\ContentRepository\Core\Feature\RootNodeCreation\Command\UpdateRootNodeAggregateDimensions; use Neos\ContentRepository\Core\Feature\SubtreeTagging\Command\TagSubtree; use Neos\ContentRepository\Core\Feature\SubtreeTagging\Command\UntagSubtree; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds; @@ -73,16 +78,20 @@ public function separateMatchingAndRemainingCommands( private static function commandMatchesAtLeastOneNode( RebasableToOtherWorkspaceInterface $command, - NodeAggregateIds $nodeIdsToMatch, + NodeAggregateIds $nodeAggregateIdsToMatch, ): bool { - foreach ($nodeIdsToMatch as $nodeId) { + foreach ($nodeAggregateIdsToMatch as $nodeId) { /** * This match must contain all commands which are working with individual nodes, such that they are - * filterable whether they are applying their action to a NodeIdToPublish. + * filterable whether they are applying their action to a $nodeAggregateId in question * - * This is needed to publish and discard individual nodes. + * Used to separate commands for publish and discard individual nodes + * + * NOTE: We could refactor and simplify this by asking the events {@see EmbedsNodeAggregateId} + * instead which would be more clean. But that only makes sense if we start rebasing events. */ $matches = match ($command::class) { + CreateRootNodeAggregateWithNode::class, CreateNodeAggregateWithNodeAndSerializedProperties::class, DisableNodeAggregate::class, EnableNodeAggregate::class, @@ -93,14 +102,17 @@ private static function commandMatchesAtLeastOneNode( ChangeNodeAggregateType::class, CreateNodeVariant::class, TagSubtree::class, - UntagSubtree::class + UntagSubtree::class, + UpdateRootNodeAggregateDimensions::class, => $command->nodeAggregateId->equals($nodeId), CopyNodesRecursively::class => $command->nodeAggregateIdMapping->getNewNodeAggregateId( $command->nodeTreeToInsert->nodeAggregateId )?->equals($nodeId), SetSerializedNodeReferences::class => $command->sourceNodeAggregateId->equals($nodeId), - // todo return false instead to allow change to be still kept? - default => throw new \RuntimeException(sprintf('Command %s cannot be matched against a node aggregate id. Partial publish not possible.', $command::class), 1645393655) + // for non node-aggregate-changes we return false, so they are kept as remainder: + AddDimensionShineThrough::class, + MoveDimensionSpacePoint::class => false, + default => throw new \RuntimeException(sprintf('Command %s does not have matching strategy for node aggregate id (%s). Partial workspace rebase not possible.', $nodeId->value, $command::class), 1645393655) }; if ($matches) { return true;