Closed
Description
Symfony version(s) affected
6.0.x
Description
Got three parallel applications, using same composer definition.
Only one of them make use of symfony notifier
Having installed symfony/mercure-notifier makes the other applications fail with:
The service "notifier.transport_factory.mercure" has a dependency on a non-existent service "Symfony\Component\Mercure\HubRegistry".
Checks the existence of symfony/mercure-notifier
and symfony/mercure-bundle
but NOT that symfony/mercure-bundle is enabled.
The only existence of the packages does not have to mean that are enabled for that application.
How to reproduce
- Make two parallel applications using the same composer definition.
- Install notifier and mercure-notifier on one of them.
- The other application will fail to boot as HubRegistry has to be configured
Possible Solution
- BEST: FrameworkExtension should delegate on symfony/mercure-notifier the dependency injection upon Mercure-bundle is enabled
- AFFORDABLE: FrameworkExtension could check if Mercure-Bundle is enabled.
if (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', MercureTransportFactory::class, $parentPackages)
&& ContainerBuilder::willBeAvailable('symfony/mercure-bundle', MercureBundle::class, $parentPackages)
&& array_key_exists('MercureBundle',$container->getParameter('kernel.bundles')))
- SLOPPY: notifier.transport_factory.mercure could have a nullable HubRegistry parameter, doing nothing
Additional Context
No response