src/Framework/ServiceLocator/Factory/CommandDispatcherFactory.php
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)
        );
    }
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)
        );
    }
Get proxy command handler for aggregate.

@param ServiceLocatorInterface $serviceLocator
@param string                  $key
@return CommandHandlerInterface
@throws \ExtendsFramework\ServiceLocator\ServiceLocatorException