From 965cc343b5a88100477f2b400bc16de4ce675f74 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Thu, 26 Sep 2024 11:36:59 +0200 Subject: [PATCH] TASK: Simplify code in `GraphProjectorCatchUpHookForCacheFlushing` --- .../GraphProjectorCatchUpHookForCacheFlushing.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Neos.Neos/Classes/Fusion/Cache/GraphProjectorCatchUpHookForCacheFlushing.php b/Neos.Neos/Classes/Fusion/Cache/GraphProjectorCatchUpHookForCacheFlushing.php index ec79ed487c..c5df6e9524 100644 --- a/Neos.Neos/Classes/Fusion/Cache/GraphProjectorCatchUpHookForCacheFlushing.php +++ b/Neos.Neos/Classes/Fusion/Cache/GraphProjectorCatchUpHookForCacheFlushing.php @@ -16,7 +16,6 @@ use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\EventStore\EventInterface; -use Neos\ContentRepository\Core\Feature\Common\EmbedsContentStreamId; use Neos\ContentRepository\Core\Feature\Common\EmbedsNodeAggregateId; use Neos\ContentRepository\Core\Feature\Common\EmbedsWorkspaceName; use Neos\ContentRepository\Core\Feature\NodeCreation\Event\NodeAggregateWithNodeWasCreated; @@ -38,7 +37,6 @@ use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Event\WorkspaceWasRebased; use Neos\ContentRepository\Core\Projection\CatchUpHookInterface; use Neos\ContentRepository\Core\Projection\ContentGraph\NodeAggregate; -use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\EventStore\Model\EventEnvelope; @@ -166,7 +164,6 @@ public function onBeforeEvent(EventInterface $eventInstance, EventEnvelope $even if ($nodeAggregate) { $this->scheduleCacheFlushJobForNodeAggregate( $this->contentRepository, - $eventInstance->workspaceName, $nodeAggregate, $contentGraph->findAncestorNodeAggregateIds($eventInstance->getNodeAggregateId()), ); @@ -195,7 +192,6 @@ public function onAfterEvent(EventInterface $eventInstance, EventEnvelope $event } elseif ( !($eventInstance instanceof NodeAggregateWasRemoved) && $eventInstance instanceof EmbedsNodeAggregateId - && $eventInstance instanceof EmbedsContentStreamId && $eventInstance instanceof EmbedsWorkspaceName ) { $contentGraph = $this->contentRepository->getContentGraph($eventInstance->getWorkspaceName()); @@ -206,7 +202,6 @@ public function onAfterEvent(EventInterface $eventInstance, EventEnvelope $event if ($nodeAggregate) { $this->scheduleCacheFlushJobForNodeAggregate( $this->contentRepository, - $eventInstance->getWorkspaceName(), $nodeAggregate, $contentGraph->findAncestorNodeAggregateIds($eventInstance->getNodeAggregateId()) ); @@ -216,14 +211,13 @@ public function onAfterEvent(EventInterface $eventInstance, EventEnvelope $event private function scheduleCacheFlushJobForNodeAggregate( ContentRepository $contentRepository, - WorkspaceName $workspaceName, NodeAggregate $nodeAggregate, NodeAggregateIds $ancestorNodeAggregateIds ): void { // we store this in an associative array deduplicate. - $this->flushNodeAggregateRequestsOnAfterCatchUp[$workspaceName->value . '__' . $nodeAggregate->nodeAggregateId->value] = FlushNodeAggregateRequest::create( + $this->flushNodeAggregateRequestsOnAfterCatchUp[$nodeAggregate->workspaceName->value . '__' . $nodeAggregate->nodeAggregateId->value] = FlushNodeAggregateRequest::create( $contentRepository->id, - $workspaceName, + $nodeAggregate->workspaceName, $nodeAggregate->nodeAggregateId, $nodeAggregate->nodeTypeName, $ancestorNodeAggregateIds