From 5d4e8bec6dde3c157913c2be2e52d0dd78ec4c61 Mon Sep 17 00:00:00 2001 From: bwaidelich Date: Fri, 25 Aug 2023 16:05:58 +0200 Subject: [PATCH 1/2] Apply tweaks and fixes from code review --- Classes/ContentRepository.php | 2 +- Classes/Projection/ContentStream/ContentStreamProjection.php | 2 -- .../Projection/NodeHiddenState/NodeHiddenStateProjection.php | 2 -- Classes/Projection/Workspace/WorkspaceProjection.php | 2 -- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Classes/ContentRepository.php b/Classes/ContentRepository.php index 91e63ac6..fdb29291 100644 --- a/Classes/ContentRepository.php +++ b/Classes/ContentRepository.php @@ -150,7 +150,7 @@ public function projectionState(string $projectionStateClassName): ProjectionSta return $projectionState; } } - throw new \InvalidArgumentException(sprintf('a projection state of type "%s" is not registered in this content repository instance.', $projectionStateClassName), 1662033650); + throw new \InvalidArgumentException(sprintf('A projection state of type "%s" is not registered in this content repository instance.', $projectionStateClassName), 1662033650); } /** diff --git a/Classes/Projection/ContentStream/ContentStreamProjection.php b/Classes/Projection/ContentStream/ContentStreamProjection.php index 7f3b41d8..74b9ab99 100644 --- a/Classes/Projection/ContentStream/ContentStreamProjection.php +++ b/Classes/Projection/ContentStream/ContentStreamProjection.php @@ -42,8 +42,6 @@ use Neos\EventStore\Model\Event\SequenceNumber; use Neos\EventStore\Model\EventEnvelope; -use function sprintf; - /** * See {@see ContentStreamFinder} for explanation. * diff --git a/Classes/Projection/NodeHiddenState/NodeHiddenStateProjection.php b/Classes/Projection/NodeHiddenState/NodeHiddenStateProjection.php index 6926ea82..3b83ff11 100644 --- a/Classes/Projection/NodeHiddenState/NodeHiddenStateProjection.php +++ b/Classes/Projection/NodeHiddenState/NodeHiddenStateProjection.php @@ -31,8 +31,6 @@ use Neos\EventStore\Model\Event\SequenceNumber; use Neos\EventStore\Model\EventEnvelope; -use function sprintf; - /** * TODO: this class needs proper testing * @internal diff --git a/Classes/Projection/Workspace/WorkspaceProjection.php b/Classes/Projection/Workspace/WorkspaceProjection.php index ca5d1754..35a1834a 100644 --- a/Classes/Projection/Workspace/WorkspaceProjection.php +++ b/Classes/Projection/Workspace/WorkspaceProjection.php @@ -42,8 +42,6 @@ use Neos\EventStore\Model\Event\SequenceNumber; use Neos\EventStore\Model\EventEnvelope; -use function sprintf; - /** * @internal * @implements ProjectionInterface From d6211eae14fab7c5afb071728ec1b42151fd9d0f Mon Sep 17 00:00:00 2001 From: bwaidelich Date: Sat, 26 Aug 2023 12:13:51 +0200 Subject: [PATCH 2/2] Tweak loop in `PendingProjections` --- Classes/CommandHandler/PendingProjections.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/CommandHandler/PendingProjections.php b/Classes/CommandHandler/PendingProjections.php index a6e8c077..ca2055dd 100644 --- a/Classes/CommandHandler/PendingProjections.php +++ b/Classes/CommandHandler/PendingProjections.php @@ -100,10 +100,10 @@ public static function fromProjectionsAndEventsAndSequenceNumber( $pendingProjectionsArray = []; $sequenceNumberPerProjection = []; foreach ($events as $event) { + if ($event instanceof DecoratedEvent) { + $event = $event->innerEvent; + } foreach ($allProjections as $projection) { - if ($event instanceof DecoratedEvent) { - $event = $event->innerEvent; - } if ($projection->canHandle($event)) { $sequenceNumberPerProjection[$projection::class] = $sequenceNumberInteger; if (!in_array($projection, $pendingProjectionsArray, true)) {