From e91858cde6d3c8faa85ec5d9c7da34b4542e7d41 Mon Sep 17 00:00:00 2001 From: voodooism Date: Wed, 27 Nov 2019 09:55:54 +0400 Subject: [PATCH] [Mailer] Added the ability to configure mailer component to send messages without bus --- .../FrameworkBundle/DependencyInjection/Configuration.php | 1 + .../DependencyInjection/FrameworkExtension.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 827b306bcfefa..aac05ccea0d55 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -1633,6 +1633,7 @@ private function addMailerSection(ArrayNodeDefinition $rootNode) ->end() ->end() ->end() + ->scalarNode('use_bus')->defaultTrue()->end() ->end() ->end() ->end() diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index c49575c898dd3..108e565e767be 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -2023,6 +2023,12 @@ private function registerMailerConfiguration(array $config, ContainerBuilder $co $container->getDefinition('mailer.transports')->setArgument(0, $transports); $container->getDefinition('mailer.default_transport')->setArgument(0, current($transports)); + if (!$config['use_bus']) { + $container->getDefinition('mailer.mailer') + ->setArgument(1, null) + ->setArgument(2, null); + } + $classToServices = [ SesTransportFactory::class => 'mailer.transport_factory.amazon', GmailTransportFactory::class => 'mailer.transport_factory.gmail',