|
126 | 126 | use Symfony\Component\Mime\MimeTypeGuesserInterface;
|
127 | 127 | use Symfony\Component\Mime\MimeTypes;
|
128 | 128 | use Symfony\Component\Notifier\Bridge as NotifierBridge;
|
| 129 | +use Symfony\Component\Notifier\Bridge\FakeChat\FakeChatTransportFactory; |
| 130 | +use Symfony\Component\Notifier\Bridge\FakeSms\FakeSmsTransportFactory; |
129 | 131 | use Symfony\Component\Notifier\ChatterInterface;
|
130 | 132 | use Symfony\Component\Notifier\Notifier;
|
131 | 133 | use Symfony\Component\Notifier\Recipient\Recipient;
|
@@ -2902,8 +2904,6 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
|
2902 | 2904 | NotifierBridge\Engagespot\EngagespotTransportFactory::class => 'notifier.transport_factory.engagespot',
|
2903 | 2905 | NotifierBridge\Esendex\EsendexTransportFactory::class => 'notifier.transport_factory.esendex',
|
2904 | 2906 | NotifierBridge\Expo\ExpoTransportFactory::class => 'notifier.transport_factory.expo',
|
2905 |
| - NotifierBridge\FakeChat\FakeChatTransportFactory::class => 'notifier.transport_factory.fake-chat', |
2906 |
| - NotifierBridge\FakeSms\FakeSmsTransportFactory::class => 'notifier.transport_factory.fake-sms', |
2907 | 2907 | NotifierBridge\Firebase\FirebaseTransportFactory::class => 'notifier.transport_factory.firebase',
|
2908 | 2908 | NotifierBridge\FortySixElks\FortySixElksTransportFactory::class => 'notifier.transport_factory.forty-six-elks',
|
2909 | 2909 | NotifierBridge\FreeMobile\FreeMobileTransportFactory::class => 'notifier.transport_factory.free-mobile',
|
@@ -2991,20 +2991,26 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
|
2991 | 2991 | $container->removeDefinition($classToServices[NotifierBridge\Mercure\MercureTransportFactory::class]);
|
2992 | 2992 | }
|
2993 | 2993 |
|
2994 |
| - if (ContainerBuilder::willBeAvailable('symfony/fake-chat-notifier', NotifierBridge\FakeChat\FakeChatTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) { |
2995 |
| - $container->getDefinition($classToServices[NotifierBridge\FakeChat\FakeChatTransportFactory::class]) |
2996 |
| - ->replaceArgument(0, new Reference('mailer')) |
2997 |
| - ->replaceArgument(1, new Reference('logger')) |
| 2994 | + // don't use ContainerBuilder::willBeAvailable() as these are not needed in production |
| 2995 | + if (class_exists(FakeChatTransportFactory::class)) { |
| 2996 | + $container->getDefinition('notifier.transport_factory.fake-chat') |
| 2997 | + ->replaceArgument(0, new Reference('mailer', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
| 2998 | + ->replaceArgument(1, new Reference('logger', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
2998 | 2999 | ->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
|
2999 | 3000 | ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
|
| 3001 | + } else { |
| 3002 | + $container->removeDefinition('notifier.transport_factory.fake-chat'); |
3000 | 3003 | }
|
3001 | 3004 |
|
3002 |
| - if (ContainerBuilder::willBeAvailable('symfony/fake-sms-notifier', NotifierBridge\FakeSms\FakeSmsTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) { |
3003 |
| - $container->getDefinition($classToServices[NotifierBridge\FakeSms\FakeSmsTransportFactory::class]) |
3004 |
| - ->replaceArgument(0, new Reference('mailer')) |
3005 |
| - ->replaceArgument(1, new Reference('logger')) |
| 3005 | + // don't use ContainerBuilder::willBeAvailable() as these are not needed in production |
| 3006 | + if (class_exists(FakeSmsTransportFactory::class)) { |
| 3007 | + $container->getDefinition('notifier.transport_factory.fake-sms') |
| 3008 | + ->replaceArgument(0, new Reference('mailer', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
| 3009 | + ->replaceArgument(1, new Reference('logger', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
3006 | 3010 | ->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
|
3007 | 3011 | ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
|
| 3012 | + } else { |
| 3013 | + $container->removeDefinition('notifier.transport_factory.fake-sms'); |
3008 | 3014 | }
|
3009 | 3015 |
|
3010 | 3016 | if (ContainerBuilder::willBeAvailable('symfony/bluesky-notifier', NotifierBridge\Bluesky\BlueskyTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier'])) {
|
|
0 commit comments