Saturday, 12 October 2019

Symfony ServiceSubscriber aliased service

In Symfony you can DI a different services with the same interface as followed:

public function __construct(ServiceInterface $serviceOne, ServiceInterface $serviceTwo)

But how can this be achieved the same way with the ServiceSubscriberInterface?

public static function getSubscribedServices()
{
    return [
        'commandBus' => MessageBusInterface::class . ' $commandBus',
        'queryBus' => MessageBusInterface::class . '$queryBus',
    ];
}

These are the resources I already checked: https://symfony.com/doc/current/service_container/service_subscribers_locators.html https://symfony.com/doc/current/messenger/multiple_buses.html



from Symfony ServiceSubscriber aliased service

No comments:

Post a Comment