protected function getProxyCommandHandler(ServiceLocatorInterface $serviceLocator, string $key): object
    {
        $eventStore = $serviceLocator->getService(EventStoreInterface::class);
        $eventPublisher = $serviceLocator->getService(EventPublisherInterface::class);
        $aggregate = $serviceLocator->getService($key);

        /**
         * @var EventStoreInterface            $eventStore
         * @var EventPublisherInterface        $eventPublisher
         * @var EventSourcedAggregateInterface $aggregate
         */
        return new ProxyCommandHandler(
            new EventStoreRepository($eventStore, $eventPublisher, $aggregate)
        );
    }