|
122 | 122 | use Symfony\Component\Mime\MimeTypeGuesserInterface;
|
123 | 123 | use Symfony\Component\Mime\MimeTypes;
|
124 | 124 | use Symfony\Component\Notifier\Bridge as NotifierBridge;
|
| 125 | +use Symfony\Component\Notifier\Bridge\FakeChat\FakeChatTransportFactory; |
| 126 | +use Symfony\Component\Notifier\Bridge\FakeSms\FakeSmsTransportFactory; |
125 | 127 | use Symfony\Component\Notifier\ChatterInterface;
|
126 | 128 | use Symfony\Component\Notifier\Notifier;
|
127 | 129 | use Symfony\Component\Notifier\Recipient\Recipient;
|
@@ -2812,8 +2814,6 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
|
2812 | 2814 | NotifierBridge\Engagespot\EngagespotTransportFactory::class => 'notifier.transport_factory.engagespot',
|
2813 | 2815 | NotifierBridge\Esendex\EsendexTransportFactory::class => 'notifier.transport_factory.esendex',
|
2814 | 2816 | NotifierBridge\Expo\ExpoTransportFactory::class => 'notifier.transport_factory.expo',
|
2815 |
| - NotifierBridge\FakeChat\FakeChatTransportFactory::class => 'notifier.transport_factory.fake-chat', |
2816 |
| - NotifierBridge\FakeSms\FakeSmsTransportFactory::class => 'notifier.transport_factory.fake-sms', |
2817 | 2817 | NotifierBridge\Firebase\FirebaseTransportFactory::class => 'notifier.transport_factory.firebase',
|
2818 | 2818 | NotifierBridge\FortySixElks\FortySixElksTransportFactory::class => 'notifier.transport_factory.forty-six-elks',
|
2819 | 2819 | NotifierBridge\FreeMobile\FreeMobileTransportFactory::class => 'notifier.transport_factory.free-mobile',
|
@@ -2891,20 +2891,26 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
|
2891 | 2891 | $container->removeDefinition($classToServices[NotifierBridge\Mercure\MercureTransportFactory::class]);
|
2892 | 2892 | }
|
2893 | 2893 |
|
2894 |
| - if (ContainerBuilder::willBeAvailable('symfony/fake-chat-notifier', NotifierBridge\FakeChat\FakeChatTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) { |
2895 |
| - $container->getDefinition($classToServices[NotifierBridge\FakeChat\FakeChatTransportFactory::class]) |
2896 |
| - ->replaceArgument(0, new Reference('mailer')) |
2897 |
| - ->replaceArgument(1, new Reference('logger')) |
| 2894 | + // don't use ContainerBuilder::willBeAvailable() as these are not needed in production |
| 2895 | + if (class_exists(FakeChatTransportFactory::class)) { |
| 2896 | + $container->getDefinition('notifier.transport_factory.fake-chat') |
| 2897 | + ->replaceArgument(0, new Reference('mailer', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
| 2898 | + ->replaceArgument(1, new Reference('logger', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
2898 | 2899 | ->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
|
2899 | 2900 | ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
|
| 2901 | + } else { |
| 2902 | + $container->removeDefinition('notifier.transport_factory.fake-chat'); |
2900 | 2903 | }
|
2901 | 2904 |
|
2902 |
| - if (ContainerBuilder::willBeAvailable('symfony/fake-sms-notifier', NotifierBridge\FakeSms\FakeSmsTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) { |
2903 |
| - $container->getDefinition($classToServices[NotifierBridge\FakeSms\FakeSmsTransportFactory::class]) |
2904 |
| - ->replaceArgument(0, new Reference('mailer')) |
2905 |
| - ->replaceArgument(1, new Reference('logger')) |
| 2905 | + // don't use ContainerBuilder::willBeAvailable() as these are not needed in production |
| 2906 | + if (class_exists(FakeSmsTransportFactory::class)) { |
| 2907 | + $container->getDefinition('notifier.transport_factory.fake-sms') |
| 2908 | + ->replaceArgument(0, new Reference('mailer', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
| 2909 | + ->replaceArgument(1, new Reference('logger', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
2906 | 2910 | ->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
|
2907 | 2911 | ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
|
| 2912 | + } else { |
| 2913 | + $container->removeDefinition('notifier.transport_factory.fake-sms'); |
2908 | 2914 | }
|
2909 | 2915 |
|
2910 | 2916 | if (isset($config['admin_recipients'])) {
|
|
0 commit comments