diff --git a/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php b/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php index 71ad0b90ae7..725022f02e7 100644 --- a/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php +++ b/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php @@ -15,8 +15,6 @@ namespace Neos\ContentRepository\Core; use Neos\ContentRepository\Core\CommandHandler\CommandInterface; -use Neos\ContentRepository\Core\EventStore\EventPersister; -use Neos\ContentRepository\Core\EventStore\EventsToPublish; use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphInterface; use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace; use Neos\ContentRepository\Core\SharedModel\Exception\WorkspaceDoesNotExist; @@ -40,8 +38,7 @@ final class CommandHandlingDependencies private array $overriddenContentGraphInstances = []; public function __construct( - private readonly ContentRepository $contentRepository, - private readonly EventPersister $eventPersister + private readonly ContentRepository $contentRepository ) { } @@ -50,11 +47,6 @@ public function handle(CommandInterface $command): void $this->contentRepository->handle($command); } - public function publishEvents(EventsToPublish $eventsToPublish): void - { - $this->eventPersister->publishEvents($this->contentRepository, $eventsToPublish); - } - public function getContentStreamVersion(ContentStreamId $contentStreamId): Version { $contentStream = $this->contentRepository->findContentStreamById($contentStreamId); @@ -119,4 +111,12 @@ public function overrideContentStreamId(WorkspaceName $workspaceName, ContentStr unset($this->overriddenContentGraphInstances[$workspaceName->value]); } } + + /** + * Fixme only required to build the possible catchup hooks + */ + public function getContentRepository(): ContentRepository + { + return $this->contentRepository; + } } diff --git a/Neos.ContentRepository.Core/Classes/ContentRepository.php b/Neos.ContentRepository.Core/Classes/ContentRepository.php index fd86bbdbebb..0f4fa64fcf1 100644 --- a/Neos.ContentRepository.Core/Classes/ContentRepository.php +++ b/Neos.ContentRepository.Core/Classes/ContentRepository.php @@ -87,7 +87,7 @@ public function __construct( private readonly UserIdProviderInterface $userIdProvider, private readonly ClockInterface $clock, ) { - $this->commandHandlingDependencies = new CommandHandlingDependencies($this, $eventPersister); + $this->commandHandlingDependencies = new CommandHandlingDependencies($this); } /** diff --git a/Neos.ContentRepository.Core/Classes/Factory/ContentRepositoryFactory.php b/Neos.ContentRepository.Core/Classes/Factory/ContentRepositoryFactory.php index 3c81c0adb56..94f734c3911 100644 --- a/Neos.ContentRepository.Core/Classes/Factory/ContentRepositoryFactory.php +++ b/Neos.ContentRepository.Core/Classes/Factory/ContentRepositoryFactory.php @@ -135,6 +135,7 @@ private function buildCommandBus(): CommandBus new ContentStreamCommandHandler( ), new WorkspaceCommandHandler( + $this->buildEventPersister(), $this->projectionFactoryDependencies->eventStore, $this->projectionFactoryDependencies->eventNormalizer, ), diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php index 5f598678bdb..1851a976560 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php @@ -81,6 +81,7 @@ final readonly class WorkspaceCommandHandler implements CommandHandlerInterface { public function __construct( + private EventPersister $eventPersister, private EventStoreInterface $eventStore, private EventNormalizer $eventNormalizer, ) { @@ -289,7 +290,8 @@ private function publishContentStream( return; } try { - $commandHandlingDependencies->publishEvents( + $this->eventPersister->publishEvents( + $commandHandlingDependencies->getContentRepository(), new EventsToPublish( $baseWorkspaceContentStreamName->getEventStreamName(), Events::fromArray($events),