2525use Symfony \Bundle \FrameworkBundle \Routing \AnnotatedRouteControllerLoader ;
2626use Symfony \Bundle \FrameworkBundle \Routing \RouteLoaderInterface ;
2727use Symfony \Bundle \FullStack ;
28+ use Symfony \Bundle \MercureBundle \MercureBundle ;
2829use Symfony \Component \Asset \PackageInterface ;
2930use Symfony \Component \BrowserKit \AbstractBrowser ;
3031use Symfony \Component \Cache \Adapter \AdapterInterface ;
4344use Symfony \Component \Console \Command \Command ;
4445use Symfony \Component \DependencyInjection \Alias ;
4546use Symfony \Component \DependencyInjection \Argument \ServiceClosureArgument ;
47+ use Symfony \Component \DependencyInjection \Argument \ServiceLocatorArgument ;
48+ use Symfony \Component \DependencyInjection \Argument \TaggedIteratorArgument ;
4649use Symfony \Component \DependencyInjection \ChildDefinition ;
4750use Symfony \Component \DependencyInjection \Compiler \ServiceLocatorTagPass ;
4851use Symfony \Component \DependencyInjection \ContainerBuilder ;
112115use Symfony \Component \Notifier \Bridge \Iqsms \IqsmsTransportFactory ;
113116use Symfony \Component \Notifier \Bridge \LinkedIn \LinkedInTransportFactory ;
114117use Symfony \Component \Notifier \Bridge \Mattermost \MattermostTransportFactory ;
118+ use Symfony \Component \Notifier \Bridge \Mercure \MercureTransportFactory ;
115119use Symfony \Component \Notifier \Bridge \Mobyt \MobytTransportFactory ;
116120use Symfony \Component \Notifier \Bridge \Nexmo \NexmoTransportFactory ;
117121use Symfony \Component \Notifier \Bridge \Octopush \OctopushTransportFactory ;
@@ -2242,6 +2246,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
22422246 LinkedInTransportFactory::class => 'notifier.transport_factory.linkedin ' ,
22432247 GatewayApiTransportFactory::class => 'notifier.transport_factory.gatewayapi ' ,
22442248 OctopushTransportFactory::class => 'notifier.transport_factory.octopush ' ,
2249+ MercureTransportFactory::class => 'notifier.transport_factory.mercure ' ,
22452250 ];
22462251
22472252 foreach ($ classToServices as $ class => $ service ) {
@@ -2250,6 +2255,15 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
22502255 }
22512256 }
22522257
2258+ if (class_exists (MercureTransportFactory::class)) {
2259+ if (!class_exists (MercureBundle::class)) {
2260+ throw new \LogicException ('The MercureBundle is not registered in your application. Try running "composer require symfony/mercure-bundle". ' );
2261+ }
2262+
2263+ $ container ->getDefinition ($ classToServices [MercureTransportFactory::class])
2264+ ->replaceArgument ('$publisherLocator ' , new ServiceLocatorArgument (new TaggedIteratorArgument ('mercure.publisher ' , null , null , true )));
2265+ }
2266+
22532267 if (isset ($ config ['admin_recipients ' ])) {
22542268 $ notifier = $ container ->getDefinition ('notifier ' );
22552269 foreach ($ config ['admin_recipients ' ] as $ i => $ recipient ) {
0 commit comments