|
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; |
@@ -2762,8 +2764,6 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $ |
2762 | 2764 | NotifierBridge\Engagespot\EngagespotTransportFactory::class => 'notifier.transport_factory.engagespot', |
2763 | 2765 | NotifierBridge\Esendex\EsendexTransportFactory::class => 'notifier.transport_factory.esendex', |
2764 | 2766 | NotifierBridge\Expo\ExpoTransportFactory::class => 'notifier.transport_factory.expo', |
2765 | | - NotifierBridge\FakeChat\FakeChatTransportFactory::class => 'notifier.transport_factory.fake-chat', |
2766 | | - NotifierBridge\FakeSms\FakeSmsTransportFactory::class => 'notifier.transport_factory.fake-sms', |
2767 | 2767 | NotifierBridge\Firebase\FirebaseTransportFactory::class => 'notifier.transport_factory.firebase', |
2768 | 2768 | NotifierBridge\FortySixElks\FortySixElksTransportFactory::class => 'notifier.transport_factory.forty-six-elks', |
2769 | 2769 | NotifierBridge\FreeMobile\FreeMobileTransportFactory::class => 'notifier.transport_factory.free-mobile', |
@@ -2847,20 +2847,26 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $ |
2847 | 2847 | $container->removeDefinition($classToServices[NotifierBridge\Mercure\MercureTransportFactory::class]); |
2848 | 2848 | } |
2849 | 2849 |
|
2850 | | - if (ContainerBuilder::willBeAvailable('symfony/fake-chat-notifier', NotifierBridge\FakeChat\FakeChatTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) { |
2851 | | - $container->getDefinition($classToServices[NotifierBridge\FakeChat\FakeChatTransportFactory::class]) |
2852 | | - ->replaceArgument(0, new Reference('mailer')) |
2853 | | - ->replaceArgument(1, new Reference('logger')) |
| 2850 | + // don't use ContainerBuilder::willBeAvailable() as these are not needed in production |
| 2851 | + if (class_exists(FakeChatTransportFactory::class)) { |
| 2852 | + $container->getDefinition('notifier.transport_factory.fake-chat') |
| 2853 | + ->replaceArgument(0, new Reference('mailer', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
| 2854 | + ->replaceArgument(1, new Reference('logger', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
2854 | 2855 | ->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
2855 | 2856 | ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE)); |
| 2857 | + } else { |
| 2858 | + $container->removeDefinition('notifier.transport_factory.fake-chat'); |
2856 | 2859 | } |
2857 | 2860 |
|
2858 | | - if (ContainerBuilder::willBeAvailable('symfony/fake-sms-notifier', NotifierBridge\FakeSms\FakeSmsTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) { |
2859 | | - $container->getDefinition($classToServices[NotifierBridge\FakeSms\FakeSmsTransportFactory::class]) |
2860 | | - ->replaceArgument(0, new Reference('mailer')) |
2861 | | - ->replaceArgument(1, new Reference('logger')) |
| 2861 | + // don't use ContainerBuilder::willBeAvailable() as these are not needed in production |
| 2862 | + if (class_exists(FakeSmsTransportFactory::class)) { |
| 2863 | + $container->getDefinition('notifier.transport_factory.fake-sms') |
| 2864 | + ->replaceArgument(0, new Reference('mailer', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
| 2865 | + ->replaceArgument(1, new Reference('logger', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
2862 | 2866 | ->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE)) |
2863 | 2867 | ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE)); |
| 2868 | + } else { |
| 2869 | + $container->removeDefinition('notifier.transport_factory.fake-sms'); |
2864 | 2870 | } |
2865 | 2871 |
|
2866 | 2872 | if (ContainerBuilder::willBeAvailable('symfony/bluesky-notifier', NotifierBridge\Bluesky\BlueskyTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier'])) { |
|
0 commit comments