From 5fd8ab37feee6a92473f007061c891643ab88d75 Mon Sep 17 00:00:00 2001 From: Bastian Waidelich Date: Fri, 8 Nov 2024 16:17:01 +0100 Subject: [PATCH 1/7] TASK: Adjust to "serializable commands" Related: https://github.com/neos/neos-development-collection/issues/5353 Related: https://github.com/neos/neos-development-collection/pull/5348 --- .../Infrastructure/ContentRepository/ConflictsFactory.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php index ab3fdf31f3..b63d5a1071 100644 --- a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php +++ b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php @@ -14,9 +14,9 @@ namespace Neos\Neos\Ui\Infrastructure\ContentRepository; -use Neos\ContentRepository\Core\CommandHandler\CommandInterface; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; +use Neos\ContentRepository\Core\Feature\Common\RebasableToOtherWorkspaceInterface; use Neos\ContentRepository\Core\Feature\NodeCreation\Command\CreateNodeAggregateWithNode; use Neos\ContentRepository\Core\Feature\NodeCreation\Command\CreateNodeAggregateWithNodeAndSerializedProperties; use Neos\ContentRepository\Core\Feature\NodeDisabling\Command\DisableNodeAggregate; @@ -139,7 +139,7 @@ private function createConflictFromCommandThatFailedDuringRebase( ); } - private function extractNodeAggregateIdFromCommand(CommandInterface $command): ?NodeAggregateId + private function extractNodeAggregateIdFromCommand(RebasableToOtherWorkspaceInterface $command): ?NodeAggregateId { return match (true) { $command instanceof MoveNodeAggregate, @@ -163,7 +163,7 @@ private function extractNodeAggregateIdFromCommand(CommandInterface $command): ? } private function acquireSubgraphFromCommand( - CommandInterface $command, + RebasableToOtherWorkspaceInterface $command, ?NodeAggregateId $nodeAggregateIdForDimensionFallback ): ?ContentSubgraphInterface { if ($this->workspace === null) { @@ -248,7 +248,7 @@ private function createIconLabelForNode(Node $node): IconLabel } private function createTypeOfChangeFromCommand( - CommandInterface $command + RebasableToOtherWorkspaceInterface $command ): ?TypeOfChange { return match (true) { $command instanceof CreateNodeAggregateWithNode, From 8619c7729e815a590981840ab3e4ff60df300793 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 9 Nov 2024 11:27:40 +0100 Subject: [PATCH 2/7] TASK: Adjust to overhauled api of `CommandThatFailedDuringRebase` --- .../ContentRepository/ConflictsFactory.php | 90 ++++++------------- 1 file changed, 28 insertions(+), 62 deletions(-) diff --git a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php index b63d5a1071..2af7051498 100644 --- a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php +++ b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php @@ -17,14 +17,11 @@ use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\Feature\Common\RebasableToOtherWorkspaceInterface; -use Neos\ContentRepository\Core\Feature\NodeCreation\Command\CreateNodeAggregateWithNode; use Neos\ContentRepository\Core\Feature\NodeCreation\Command\CreateNodeAggregateWithNodeAndSerializedProperties; use Neos\ContentRepository\Core\Feature\NodeDisabling\Command\DisableNodeAggregate; use Neos\ContentRepository\Core\Feature\NodeDisabling\Command\EnableNodeAggregate; -use Neos\ContentRepository\Core\Feature\NodeModification\Command\SetNodeProperties; use Neos\ContentRepository\Core\Feature\NodeModification\Command\SetSerializedNodeProperties; use Neos\ContentRepository\Core\Feature\NodeMove\Command\MoveNodeAggregate; -use Neos\ContentRepository\Core\Feature\NodeReferencing\Command\SetNodeReferences; use Neos\ContentRepository\Core\Feature\NodeReferencing\Command\SetSerializedNodeReferences; use Neos\ContentRepository\Core\Feature\NodeRemoval\Command\RemoveNodeAggregate; use Neos\ContentRepository\Core\Feature\NodeTypeChange\Command\ChangeNodeAggregateType; @@ -94,11 +91,9 @@ public function fromWorkspaceRebaseFailed( private function createConflictFromCommandThatFailedDuringRebase( CommandThatFailedDuringRebase $commandThatFailedDuringRebase ): Conflict { - $nodeAggregateId = $this->extractNodeAggregateIdFromCommand( - $commandThatFailedDuringRebase->command - ); + $nodeAggregateId = $commandThatFailedDuringRebase->getAffectedNodeAggregateId(); $subgraph = $this->acquireSubgraphFromCommand( - $commandThatFailedDuringRebase->command, + $commandThatFailedDuringRebase->getCommand(), $nodeAggregateId ); $affectedSite = $nodeAggregateId @@ -131,37 +126,14 @@ private function createConflictFromCommandThatFailedDuringRebase( ? $this->createIconLabelForNode($affectedNode) : null, typeOfChange: $this->createTypeOfChangeFromCommand( - $commandThatFailedDuringRebase->command + $commandThatFailedDuringRebase->getCommand() ), reasonForConflict: $this->createReasonForConflictFromException( - $commandThatFailedDuringRebase->exception + $commandThatFailedDuringRebase->getException() ) ); } - private function extractNodeAggregateIdFromCommand(RebasableToOtherWorkspaceInterface $command): ?NodeAggregateId - { - return match (true) { - $command instanceof MoveNodeAggregate, - $command instanceof SetNodeProperties, - $command instanceof SetSerializedNodeProperties, - $command instanceof CreateNodeAggregateWithNode, - $command instanceof CreateNodeAggregateWithNodeAndSerializedProperties, - $command instanceof TagSubtree, - $command instanceof DisableNodeAggregate, - $command instanceof UntagSubtree, - $command instanceof EnableNodeAggregate, - $command instanceof RemoveNodeAggregate, - $command instanceof ChangeNodeAggregateType, - $command instanceof CreateNodeVariant => - $command->nodeAggregateId, - $command instanceof SetNodeReferences, - $command instanceof SetSerializedNodeReferences => - $command->sourceNodeAggregateId, - default => null - }; - } - private function acquireSubgraphFromCommand( RebasableToOtherWorkspaceInterface $command, ?NodeAggregateId $nodeAggregateIdForDimensionFallback @@ -170,26 +142,23 @@ private function acquireSubgraphFromCommand( return null; } - $dimensionSpacePoint = match (true) { - $command instanceof MoveNodeAggregate => + $dimensionSpacePoint = match ($command::class) { + MoveNodeAggregate::class => $command->dimensionSpacePoint, - $command instanceof SetNodeProperties, - $command instanceof SetSerializedNodeProperties, - $command instanceof CreateNodeAggregateWithNode, - $command instanceof CreateNodeAggregateWithNodeAndSerializedProperties => + SetSerializedNodeProperties::class, + CreateNodeAggregateWithNodeAndSerializedProperties::class => $command->originDimensionSpacePoint->toDimensionSpacePoint(), - $command instanceof SetNodeReferences, - $command instanceof SetSerializedNodeReferences => + SetSerializedNodeReferences::class => $command->sourceOriginDimensionSpacePoint->toDimensionSpacePoint(), - $command instanceof TagSubtree, - $command instanceof DisableNodeAggregate, - $command instanceof UntagSubtree, - $command instanceof EnableNodeAggregate, - $command instanceof RemoveNodeAggregate => + TagSubtree::class, + DisableNodeAggregate::class, + UntagSubtree::class, + EnableNodeAggregate::class, + RemoveNodeAggregate::class => $command->coveredDimensionSpacePoint, - $command instanceof ChangeNodeAggregateType => + ChangeNodeAggregateType::class => null, - $command instanceof CreateNodeVariant => + CreateNodeVariant::class => $command->targetOrigin->toDimensionSpacePoint(), default => null }; @@ -250,24 +219,21 @@ private function createIconLabelForNode(Node $node): IconLabel private function createTypeOfChangeFromCommand( RebasableToOtherWorkspaceInterface $command ): ?TypeOfChange { - return match (true) { - $command instanceof CreateNodeAggregateWithNode, - $command instanceof CreateNodeAggregateWithNodeAndSerializedProperties, - $command instanceof CreateNodeVariant => + return match ($command::class) { + CreateNodeAggregateWithNodeAndSerializedProperties::class, + CreateNodeVariant::class => TypeOfChange::NODE_HAS_BEEN_CREATED, - $command instanceof SetNodeProperties, - $command instanceof SetSerializedNodeProperties, - $command instanceof SetNodeReferences, - $command instanceof SetSerializedNodeReferences, - $command instanceof TagSubtree, - $command instanceof DisableNodeAggregate, - $command instanceof UntagSubtree, - $command instanceof EnableNodeAggregate, - $command instanceof ChangeNodeAggregateType => + SetSerializedNodeProperties::class, + SetSerializedNodeReferences::class, + TagSubtree::class, + DisableNodeAggregate::class, + UntagSubtree::class, + EnableNodeAggregate::class, + ChangeNodeAggregateType::class => TypeOfChange::NODE_HAS_BEEN_CHANGED, - $command instanceof MoveNodeAggregate => + MoveNodeAggregate::class => TypeOfChange::NODE_HAS_BEEN_MOVED, - $command instanceof RemoveNodeAggregate => + RemoveNodeAggregate::class => TypeOfChange::NODE_HAS_BEEN_DELETED, default => null }; From e2ee696e30f91457f2387d42b2ec38d409f26c61 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 9 Nov 2024 17:49:10 +0100 Subject: [PATCH 3/7] TASK: Extract conflict information from event and not possibly internal command --- .../ContentRepository/ConflictsFactory.php | 111 +++++++++--------- 1 file changed, 55 insertions(+), 56 deletions(-) diff --git a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php index 2af7051498..9a68b641bc 100644 --- a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php +++ b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php @@ -16,19 +16,18 @@ use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; -use Neos\ContentRepository\Core\Feature\Common\RebasableToOtherWorkspaceInterface; -use Neos\ContentRepository\Core\Feature\NodeCreation\Command\CreateNodeAggregateWithNodeAndSerializedProperties; -use Neos\ContentRepository\Core\Feature\NodeDisabling\Command\DisableNodeAggregate; -use Neos\ContentRepository\Core\Feature\NodeDisabling\Command\EnableNodeAggregate; -use Neos\ContentRepository\Core\Feature\NodeModification\Command\SetSerializedNodeProperties; -use Neos\ContentRepository\Core\Feature\NodeMove\Command\MoveNodeAggregate; -use Neos\ContentRepository\Core\Feature\NodeReferencing\Command\SetSerializedNodeReferences; -use Neos\ContentRepository\Core\Feature\NodeRemoval\Command\RemoveNodeAggregate; -use Neos\ContentRepository\Core\Feature\NodeTypeChange\Command\ChangeNodeAggregateType; -use Neos\ContentRepository\Core\Feature\NodeVariation\Command\CreateNodeVariant; -use Neos\ContentRepository\Core\Feature\SubtreeTagging\Command\TagSubtree; -use Neos\ContentRepository\Core\Feature\SubtreeTagging\Command\UntagSubtree; -use Neos\ContentRepository\Core\Feature\WorkspaceRebase\CommandThatFailedDuringRebase; +use Neos\ContentRepository\Core\EventStore\EventInterface; +use Neos\ContentRepository\Core\Feature\NodeCreation\Event\NodeAggregateWithNodeWasCreated; +use Neos\ContentRepository\Core\Feature\NodeModification\Event\NodePropertiesWereSet; +use Neos\ContentRepository\Core\Feature\NodeMove\Event\NodeAggregateWasMoved; +use Neos\ContentRepository\Core\Feature\NodeReferencing\Event\NodeReferencesWereSet; +use Neos\ContentRepository\Core\Feature\NodeRemoval\Event\NodeAggregateWasRemoved; +use Neos\ContentRepository\Core\Feature\NodeTypeChange\Event\NodeAggregateTypeWasChanged; +use Neos\ContentRepository\Core\Feature\NodeVariation\Event\NodeGeneralizationVariantWasCreated; +use Neos\ContentRepository\Core\Feature\NodeVariation\Event\NodePeerVariantWasCreated; +use Neos\ContentRepository\Core\Feature\SubtreeTagging\Event\SubtreeWasTagged; +use Neos\ContentRepository\Core\Feature\SubtreeTagging\Event\SubtreeWasUntagged; +use Neos\ContentRepository\Core\Feature\WorkspaceRebase\EventThatFailedDuringRebase; use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Exception\WorkspaceRebaseFailed; use Neos\ContentRepository\Core\NodeType\NodeTypeManager; use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface; @@ -77,8 +76,8 @@ public function fromWorkspaceRebaseFailed( /** @var array */ $conflictsByKey = []; - foreach ($workspaceRebaseFailed->commandsThatFailedDuringRebase as $commandThatFailedDuringRebase) { - $conflict = $this->createConflictFromCommandThatFailedDuringRebase($commandThatFailedDuringRebase); + foreach ($workspaceRebaseFailed->eventsThatFailedDuringRebase as $eventThatFailedDuringRebase) { + $conflict = $this->createConflictFromEventThatFailedDuringRebase($eventThatFailedDuringRebase); if (array_key_exists($conflict->key, $conflictsByKey)) { // deduplicate if the conflict affects the same node $conflictsByKey[$conflict->key] = $conflict; @@ -88,12 +87,12 @@ public function fromWorkspaceRebaseFailed( return new Conflicts(...$conflictsByKey); } - private function createConflictFromCommandThatFailedDuringRebase( - CommandThatFailedDuringRebase $commandThatFailedDuringRebase + private function createConflictFromEventThatFailedDuringRebase( + EventThatFailedDuringRebase $eventThatFailedDuringRebase ): Conflict { - $nodeAggregateId = $commandThatFailedDuringRebase->getAffectedNodeAggregateId(); - $subgraph = $this->acquireSubgraphFromCommand( - $commandThatFailedDuringRebase->getCommand(), + $nodeAggregateId = $eventThatFailedDuringRebase->getAffectedNodeAggregateId(); + $subgraph = $this->acquireSubgraph( + $eventThatFailedDuringRebase->getEvent(), $nodeAggregateId ); $affectedSite = $nodeAggregateId @@ -125,41 +124,42 @@ private function createConflictFromCommandThatFailedDuringRebase( affectedNode: $affectedNode ? $this->createIconLabelForNode($affectedNode) : null, - typeOfChange: $this->createTypeOfChangeFromCommand( - $commandThatFailedDuringRebase->getCommand() + typeOfChange: $this->createTypeOfChange( + $eventThatFailedDuringRebase->getEvent() ), reasonForConflict: $this->createReasonForConflictFromException( - $commandThatFailedDuringRebase->getException() + $eventThatFailedDuringRebase->getException() ) ); } - private function acquireSubgraphFromCommand( - RebasableToOtherWorkspaceInterface $command, + private function acquireSubgraph( + EventInterface $event, ?NodeAggregateId $nodeAggregateIdForDimensionFallback ): ?ContentSubgraphInterface { if ($this->workspace === null) { return null; } - $dimensionSpacePoint = match ($command::class) { - MoveNodeAggregate::class => - $command->dimensionSpacePoint, - SetSerializedNodeProperties::class, - CreateNodeAggregateWithNodeAndSerializedProperties::class => - $command->originDimensionSpacePoint->toDimensionSpacePoint(), - SetSerializedNodeReferences::class => - $command->sourceOriginDimensionSpacePoint->toDimensionSpacePoint(), - TagSubtree::class, - DisableNodeAggregate::class, - UntagSubtree::class, - EnableNodeAggregate::class, - RemoveNodeAggregate::class => - $command->coveredDimensionSpacePoint, - ChangeNodeAggregateType::class => + $dimensionSpacePoint = match ($event::class) { + NodeAggregateWasMoved::class => + $event->succeedingSiblingsForCoverage->toDimensionSpacePointSet()->getFirst(), + NodePropertiesWereSet::class, + NodeAggregateWithNodeWasCreated::class => + $event->originDimensionSpacePoint->toDimensionSpacePoint(), + NodeReferencesWereSet::class => + $event->affectedSourceOriginDimensionSpacePoints->toDimensionSpacePointSet()->getFirst(), + SubtreeWasTagged::class, + SubtreeWasUntagged::class => + $event->affectedDimensionSpacePoints->getFirst(), + NodeAggregateWasRemoved::class => + $event->affectedCoveredDimensionSpacePoints->getFirst(), + NodeAggregateTypeWasChanged::class => null, - CreateNodeVariant::class => - $command->targetOrigin->toDimensionSpacePoint(), + NodePeerVariantWasCreated::class => + $event->peerOrigin->toDimensionSpacePoint(), + NodeGeneralizationVariantWasCreated::class => + $event->generalizationOrigin->toDimensionSpacePoint(), default => null }; @@ -216,24 +216,23 @@ private function createIconLabelForNode(Node $node): IconLabel ); } - private function createTypeOfChangeFromCommand( - RebasableToOtherWorkspaceInterface $command + private function createTypeOfChange( + EventInterface $event ): ?TypeOfChange { - return match ($command::class) { - CreateNodeAggregateWithNodeAndSerializedProperties::class, - CreateNodeVariant::class => + return match ($event::class) { + NodeAggregateWithNodeWasCreated::class, + NodePeerVariantWasCreated::class, + NodeGeneralizationVariantWasCreated::class => TypeOfChange::NODE_HAS_BEEN_CREATED, - SetSerializedNodeProperties::class, - SetSerializedNodeReferences::class, - TagSubtree::class, - DisableNodeAggregate::class, - UntagSubtree::class, - EnableNodeAggregate::class, - ChangeNodeAggregateType::class => + NodePropertiesWereSet::class, + NodeReferencesWereSet::class, + SubtreeWasTagged::class, + SubtreeWasUntagged::class, + NodeAggregateTypeWasChanged::class => TypeOfChange::NODE_HAS_BEEN_CHANGED, - MoveNodeAggregate::class => + NodeAggregateWasMoved::class => TypeOfChange::NODE_HAS_BEEN_MOVED, - RemoveNodeAggregate::class => + NodeAggregateWasRemoved::class => TypeOfChange::NODE_HAS_BEEN_DELETED, default => null }; From c2e9f67ad2a0ce1dcbaefd37c12a97b8a589f34f Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 9 Nov 2024 17:56:22 +0100 Subject: [PATCH 4/7] TASK: Adjust to rename `EventThatFailedDuringRebase` to `ConflictingEvent` --- .../Infrastructure/ContentRepository/ConflictsFactory.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php index 9a68b641bc..8fd34f809c 100644 --- a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php +++ b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php @@ -27,7 +27,7 @@ use Neos\ContentRepository\Core\Feature\NodeVariation\Event\NodePeerVariantWasCreated; use Neos\ContentRepository\Core\Feature\SubtreeTagging\Event\SubtreeWasTagged; use Neos\ContentRepository\Core\Feature\SubtreeTagging\Event\SubtreeWasUntagged; -use Neos\ContentRepository\Core\Feature\WorkspaceRebase\EventThatFailedDuringRebase; +use Neos\ContentRepository\Core\Feature\WorkspaceRebase\ConflictingEvent; use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Exception\WorkspaceRebaseFailed; use Neos\ContentRepository\Core\NodeType\NodeTypeManager; use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface; @@ -76,7 +76,7 @@ public function fromWorkspaceRebaseFailed( /** @var array */ $conflictsByKey = []; - foreach ($workspaceRebaseFailed->eventsThatFailedDuringRebase as $eventThatFailedDuringRebase) { + foreach ($workspaceRebaseFailed->conflictingEvents as $eventThatFailedDuringRebase) { $conflict = $this->createConflictFromEventThatFailedDuringRebase($eventThatFailedDuringRebase); if (array_key_exists($conflict->key, $conflictsByKey)) { // deduplicate if the conflict affects the same node @@ -88,7 +88,7 @@ public function fromWorkspaceRebaseFailed( } private function createConflictFromEventThatFailedDuringRebase( - EventThatFailedDuringRebase $eventThatFailedDuringRebase + ConflictingEvent $eventThatFailedDuringRebase ): Conflict { $nodeAggregateId = $eventThatFailedDuringRebase->getAffectedNodeAggregateId(); $subgraph = $this->acquireSubgraph( From 9175b0ea265565441fb5ce1cbe164780bf0046cb Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 9 Nov 2024 19:27:05 +0100 Subject: [PATCH 5/7] TASK: Adjust to rename `EventThatFailedDuringRebase` to `ConflictingEvent` 2 --- .../ContentRepository/ConflictsFactory.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php index 8fd34f809c..013215e7c1 100644 --- a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php +++ b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php @@ -87,12 +87,12 @@ public function fromWorkspaceRebaseFailed( return new Conflicts(...$conflictsByKey); } - private function createConflictFromEventThatFailedDuringRebase( - ConflictingEvent $eventThatFailedDuringRebase + private function createConflict( + ConflictingEvent $conflictingEvent ): Conflict { - $nodeAggregateId = $eventThatFailedDuringRebase->getAffectedNodeAggregateId(); + $nodeAggregateId = $conflictingEvent->getAffectedNodeAggregateId(); $subgraph = $this->acquireSubgraph( - $eventThatFailedDuringRebase->getEvent(), + $conflictingEvent->getEvent(), $nodeAggregateId ); $affectedSite = $nodeAggregateId @@ -125,10 +125,10 @@ private function createConflictFromEventThatFailedDuringRebase( ? $this->createIconLabelForNode($affectedNode) : null, typeOfChange: $this->createTypeOfChange( - $eventThatFailedDuringRebase->getEvent() + $conflictingEvent->getEvent() ), reasonForConflict: $this->createReasonForConflictFromException( - $eventThatFailedDuringRebase->getException() + $conflictingEvent->getException() ) ); } From 829645a1555bcbf85e33a4cf23239d8fac9fa655 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 9 Nov 2024 19:28:01 +0100 Subject: [PATCH 6/7] BUGFIX: No conflicts are shown Regression from 36a5de71e2f1d9da88d64bb8ede316bcd47083fe as the deduplication did not work. --- .../Infrastructure/ContentRepository/ConflictsFactory.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php index 013215e7c1..c78e75c603 100644 --- a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php +++ b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php @@ -76,9 +76,9 @@ public function fromWorkspaceRebaseFailed( /** @var array */ $conflictsByKey = []; - foreach ($workspaceRebaseFailed->conflictingEvents as $eventThatFailedDuringRebase) { - $conflict = $this->createConflictFromEventThatFailedDuringRebase($eventThatFailedDuringRebase); - if (array_key_exists($conflict->key, $conflictsByKey)) { + foreach ($workspaceRebaseFailed->conflictingEvents as $conflictingEvent) { + $conflict = $this->createConflict($conflictingEvent); + if (!array_key_exists($conflict->key, $conflictsByKey)) { // deduplicate if the conflict affects the same node $conflictsByKey[$conflict->key] = $conflict; } From 33b9bac130ac117de9ad9e351d3e87934f0af786 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:02:04 +0100 Subject: [PATCH 7/7] TASK: Adjust to use `firstDimensionSpacePoint` --- .../ContentRepository/ConflictsFactory.php | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php index c78e75c603..a9268c8e8d 100644 --- a/Classes/Infrastructure/ContentRepository/ConflictsFactory.php +++ b/Classes/Infrastructure/ContentRepository/ConflictsFactory.php @@ -16,6 +16,7 @@ use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; +use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet; use Neos\ContentRepository\Core\EventStore\EventInterface; use Neos\ContentRepository\Core\Feature\NodeCreation\Event\NodeAggregateWithNodeWasCreated; use Neos\ContentRepository\Core\Feature\NodeModification\Event\NodePropertiesWereSet; @@ -143,17 +144,21 @@ private function acquireSubgraph( $dimensionSpacePoint = match ($event::class) { NodeAggregateWasMoved::class => - $event->succeedingSiblingsForCoverage->toDimensionSpacePointSet()->getFirst(), + // TODO it seems the event lost some information here from the intention + self::firstDimensionSpacePoint($event->succeedingSiblingsForCoverage->toDimensionSpacePointSet()), NodePropertiesWereSet::class, NodeAggregateWithNodeWasCreated::class => $event->originDimensionSpacePoint->toDimensionSpacePoint(), NodeReferencesWereSet::class => - $event->affectedSourceOriginDimensionSpacePoints->toDimensionSpacePointSet()->getFirst(), + // TODO it seems the event lost some information here from the intention + self::firstDimensionSpacePoint($event->affectedSourceOriginDimensionSpacePoints->toDimensionSpacePointSet()), SubtreeWasTagged::class, SubtreeWasUntagged::class => - $event->affectedDimensionSpacePoints->getFirst(), + // TODO it seems the event lost some information here from the intention + self::firstDimensionSpacePoint($event->affectedDimensionSpacePoints), NodeAggregateWasRemoved::class => - $event->affectedCoveredDimensionSpacePoints->getFirst(), + // TODO it seems the event lost some information here from the intention + self::firstDimensionSpacePoint($event->affectedCoveredDimensionSpacePoints), NodeAggregateTypeWasChanged::class => null, NodePeerVariantWasCreated::class => @@ -247,4 +252,12 @@ private function createReasonForConflictFromException( default => null }; } + + private static function firstDimensionSpacePoint(DimensionSpacePointSet $dimensionSpacePointSet): ?DimensionSpacePoint + { + foreach ($dimensionSpacePointSet->points as $point) { + return $point; + } + return null; + } }