|
120 | 120 | use Symfony\Component\Mime\MimeTypeGuesserInterface;
|
121 | 121 | use Symfony\Component\Mime\MimeTypes;
|
122 | 122 | use Symfony\Component\Notifier\Bridge as NotifierBridge;
|
| 123 | +use Symfony\Component\Notifier\Bridge\FakeChat\FakeChatTransportFactory; |
| 124 | +use Symfony\Component\Notifier\Bridge\FakeSms\FakeSmsTransportFactory; |
123 | 125 | use Symfony\Component\Notifier\ChatterInterface;
|
124 | 126 | use Symfony\Component\Notifier\Notifier;
|
125 | 127 | use Symfony\Component\Notifier\Recipient\Recipient;
|
@@ -2833,8 +2835,6 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
|
2833 | 2835 | NotifierBridge\Engagespot\EngagespotTransportFactory::class => 'notifier.transport_factory.engagespot',
|
2834 | 2836 | NotifierBridge\Esendex\EsendexTransportFactory::class => 'notifier.transport_factory.esendex',
|
2835 | 2837 | NotifierBridge\Expo\ExpoTransportFactory::class => 'notifier.transport_factory.expo',
|
2836 |
| - NotifierBridge\FakeChat\FakeChatTransportFactory::class => 'notifier.transport_factory.fake-chat', |
2837 |
| - NotifierBridge\FakeSms\FakeSmsTransportFactory::class => 'notifier.transport_factory.fake-sms', |
2838 | 2838 | NotifierBridge\Firebase\FirebaseTransportFactory::class => 'notifier.transport_factory.firebase',
|
2839 | 2839 | NotifierBridge\FortySixElks\FortySixElksTransportFactory::class => 'notifier.transport_factory.forty-six-elks',
|
2840 | 2840 | NotifierBridge\FreeMobile\FreeMobileTransportFactory::class => 'notifier.transport_factory.free-mobile',
|
@@ -2922,20 +2922,26 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
|
2922 | 2922 | $container->removeDefinition($classToServices[NotifierBridge\Mercure\MercureTransportFactory::class]);
|
2923 | 2923 | }
|
2924 | 2924 |
|
2925 |
| - if (ContainerBuilder::willBeAvailable('symfony/fake-chat-notifier', NotifierBridge\FakeChat\FakeChatTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) { |
2926 |
| - $container->getDefinition($classToServices[NotifierBridge\FakeChat\FakeChatTransportFactory::class]) |
2927 |
| - ->replaceArgument(0, new Reference('mailer')) |
2928 |
| - ->replaceArgument(1, new Reference('logger')) |
| 2925 | + // don't use ContainerBuilder::willBeAvailable() as these are not needed in production |
| 2926 | + if (class_exists(FakeChatTransportFactory::class)) { |
| 2927 | + $container->getDefinition('notifier.transport_factory.fake-chat') |
| 2928 | + ->replaceArgument(0, new Reference('mailer', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
| 2929 | + ->replaceArgument(1, new Reference('logger', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
2929 | 2930 | ->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
|
2930 | 2931 | ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
|
| 2932 | + } else { |
| 2933 | + $container->removeDefinition('notifier.transport_factory.fake-chat'); |
2931 | 2934 | }
|
2932 | 2935 |
|
2933 |
| - if (ContainerBuilder::willBeAvailable('symfony/fake-sms-notifier', NotifierBridge\FakeSms\FakeSmsTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) { |
2934 |
| - $container->getDefinition($classToServices[NotifierBridge\FakeSms\FakeSmsTransportFactory::class]) |
2935 |
| - ->replaceArgument(0, new Reference('mailer')) |
2936 |
| - ->replaceArgument(1, new Reference('logger')) |
| 2936 | + // don't use ContainerBuilder::willBeAvailable() as these are not needed in production |
| 2937 | + if (class_exists(FakeSmsTransportFactory::class)) { |
| 2938 | + $container->getDefinition('notifier.transport_factory.fake-sms') |
| 2939 | + ->replaceArgument(0, new Reference('mailer', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
| 2940 | + ->replaceArgument(1, new Reference('logger', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
2937 | 2941 | ->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
|
2938 | 2942 | ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
|
| 2943 | + } else { |
| 2944 | + $container->removeDefinition('notifier.transport_factory.fake-sms'); |
2939 | 2945 | }
|
2940 | 2946 |
|
2941 | 2947 | if (ContainerBuilder::willBeAvailable('symfony/bluesky-notifier', NotifierBridge\Bluesky\BlueskyTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier'])) {
|
|
0 commit comments