Skip to content

Commit

Permalink
TASK: Adjust to use firstDimensionSpacePoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Nov 11, 2024
1 parent 829645a commit 33b9bac
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions Classes/Infrastructure/ContentRepository/ConflictsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 =>
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 33b9bac

Please sign in to comment.