Skip to content

Commit

Permalink
TASK: Inline condition into match call
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Jan 9, 2025
1 parent 1c4f941 commit 19cb5c2
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ public function onAfterEvent(EventInterface $eventInstance, EventEnvelope $event
}
}

if ($eventInstance instanceof WorkspaceWasRebased && $eventInstance->hasSkippedEvents()) {
// because we don't know which changes were discarded in a conflict, we discard all changes and will build up the index on succeeding calls (with the kept reapplied events)
$this->discardWorkspace($eventInstance->getWorkspaceName());
return;
}

// Note that we don't need to update the index for WorkspaceWasPublished, as updateNode will be invoked already with the published node and then clean up its previous usages in nested workspaces
match ($eventInstance::class) {
NodeAggregateWithNodeWasCreated::class => $this->updateNode($eventInstance->getWorkspaceName(), $eventInstance->nodeAggregateId, $eventInstance->originDimensionSpacePoint->toDimensionSpacePoint()),
Expand All @@ -89,6 +83,8 @@ public function onAfterEvent(EventInterface $eventInstance, EventEnvelope $event
NodePropertiesWereSet::class => $this->updateNode($eventInstance->getWorkspaceName(), $eventInstance->nodeAggregateId, $eventInstance->originDimensionSpacePoint->toDimensionSpacePoint()),
WorkspaceWasDiscarded::class => $this->discardWorkspace($eventInstance->getWorkspaceName()),
DimensionSpacePointWasMoved::class => $this->updateDimensionSpacePoint($eventInstance->getWorkspaceName(), $eventInstance->source, $eventInstance->target),
// because we don't know which changes were discarded in a conflict, we discard all changes and will build up the index on succeeding calls (with the kept reapplied events)
WorkspaceWasRebased::class => $eventInstance->hasSkippedEvents() && $this->discardWorkspace($eventInstance->getWorkspaceName()),
default => null
};
}
Expand Down

0 comments on commit 19cb5c2

Please sign in to comment.