Skip to content

Commit

Permalink
WIP Fix GraphProjectorCatchUpHookForCacheFlushing to not crash if w…
Browse files Browse the repository at this point in the history
…orkspace doesnt exist anymore

```
Scenario: When a change is applied to the forked content stream AFTER the fork, it is not visible in the live content stream. # Features/ContentStreamForking/ForkContentStreamWithoutDimensions.feature:61
      And the event NodePropertiesWereSet was published with payload:                                                             # Features/ContentStreamForking/ForkContentStreamWithoutDimensions.feature:66
        Neos\ContentRepository\Core\SharedModel\Exception\WorkspaceDoesNotExist: The source workspace user does not exist
```
  • Loading branch information
mhsdesign committed Jun 23, 2024
1 parent f395ef6 commit 5b7d3c7
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Neos\ContentRepository\Core\Feature\NodeRemoval\Event\NodeAggregateWasRemoved;
use Neos\ContentRepository\Core\Projection\CatchUpHookInterface;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodeAggregate;
use Neos\ContentRepository\Core\SharedModel\Exception\WorkspaceDoesNotExist;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\EventStore\Model\EventEnvelope;
Expand Down Expand Up @@ -140,7 +141,11 @@ public function onBeforeEvent(EventInterface $eventInstance, EventEnvelope $even
// cleared, leading to presumably duplicate nodes in the UI.
|| $eventInstance instanceof NodeAggregateWasMoved
) {
$contentGraph = $this->contentRepository->getContentGraph($eventInstance->workspaceName);
try {
$contentGraph = $this->contentRepository->getContentGraph($eventInstance->workspaceName);
} catch (WorkspaceDoesNotExist) {
return;
}
$nodeAggregate = $contentGraph->findNodeAggregateById(
$eventInstance->getNodeAggregateId()
);
Expand Down Expand Up @@ -178,7 +183,12 @@ public function onAfterEvent(EventInterface $eventInstance, EventEnvelope $event
/** @phpstan-ignore property.notFound */
$workspaceName = $eventInstance->workspaceName;

$nodeAggregate = $this->contentRepository->getContentGraph($workspaceName)->findNodeAggregateById(
try {
$contentGraph = $this->contentRepository->getContentGraph($workspaceName);
} catch (WorkspaceDoesNotExist) {
return;
}
$nodeAggregate = $contentGraph->findNodeAggregateById(
$eventInstance->getNodeAggregateId()
);

Expand Down

0 comments on commit 5b7d3c7

Please sign in to comment.