25
25
use Symfony \Bundle \FrameworkBundle \Routing \AnnotatedRouteControllerLoader ;
26
26
use Symfony \Bundle \FrameworkBundle \Routing \RouteLoaderInterface ;
27
27
use Symfony \Bundle \FullStack ;
28
+ use Symfony \Bundle \MercureBundle \MercureBundle ;
28
29
use Symfony \Component \Asset \PackageInterface ;
29
30
use Symfony \Component \BrowserKit \AbstractBrowser ;
30
31
use Symfony \Component \Cache \Adapter \AdapterInterface ;
43
44
use Symfony \Component \Console \Command \Command ;
44
45
use Symfony \Component \DependencyInjection \Alias ;
45
46
use Symfony \Component \DependencyInjection \Argument \ServiceClosureArgument ;
47
+ use Symfony \Component \DependencyInjection \Argument \ServiceLocatorArgument ;
48
+ use Symfony \Component \DependencyInjection \Argument \TaggedIteratorArgument ;
46
49
use Symfony \Component \DependencyInjection \ChildDefinition ;
47
50
use Symfony \Component \DependencyInjection \Compiler \ServiceLocatorTagPass ;
48
51
use Symfony \Component \DependencyInjection \ContainerBuilder ;
112
115
use Symfony \Component \Notifier \Bridge \Iqsms \IqsmsTransportFactory ;
113
116
use Symfony \Component \Notifier \Bridge \LinkedIn \LinkedInTransportFactory ;
114
117
use Symfony \Component \Notifier \Bridge \Mattermost \MattermostTransportFactory ;
118
+ use Symfony \Component \Notifier \Bridge \Mercure \MercureTransportFactory ;
115
119
use Symfony \Component \Notifier \Bridge \Mobyt \MobytTransportFactory ;
116
120
use Symfony \Component \Notifier \Bridge \Nexmo \NexmoTransportFactory ;
117
121
use Symfony \Component \Notifier \Bridge \Octopush \OctopushTransportFactory ;
@@ -2242,6 +2246,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
2242
2246
LinkedInTransportFactory::class => 'notifier.transport_factory.linkedin ' ,
2243
2247
GatewayApiTransportFactory::class => 'notifier.transport_factory.gatewayapi ' ,
2244
2248
OctopushTransportFactory::class => 'notifier.transport_factory.octopush ' ,
2249
+ MercureTransportFactory::class => 'notifier.transport_factory.mercure ' ,
2245
2250
];
2246
2251
2247
2252
foreach ($ classToServices as $ class => $ service ) {
@@ -2250,6 +2255,15 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
2250
2255
}
2251
2256
}
2252
2257
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
+
2253
2267
if (isset ($ config ['admin_recipients ' ])) {
2254
2268
$ notifier = $ container ->getDefinition ('notifier ' );
2255
2269
foreach ($ config ['admin_recipients ' ] as $ i => $ recipient ) {
0 commit comments