diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index c3b22026b3caf..382b2fe64027e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -171,6 +171,7 @@ class FrameworkExtension extends Extension private $messengerConfigEnabled = false; private $mailerConfigEnabled = false; private $httpClientConfigEnabled = false; + private $notifierConfigEnabled = false; /** * Responds to the app.config configuration parameter. @@ -372,7 +373,7 @@ public function load(array $configs, ContainerBuilder $container) $this->registerMailerConfiguration($config['mailer'], $container, $loader); } - if ($this->isConfigEnabled($container, $config['notifier'])) { + if ($this->notifierConfigEnabled = $this->isConfigEnabled($container, $config['notifier'])) { $this->registerNotifierConfiguration($config['notifier'], $container, $loader); } @@ -637,6 +638,10 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $ $loader->load('http_client_debug.php'); } + if ($this->notifierConfigEnabled) { + $loader->load('notifier_debug.php'); + } + $container->setParameter('profiler_listener.only_exceptions', $config['only_exceptions']); $container->setParameter('profiler_listener.only_master_requests', $config['only_master_requests']); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier.php index 8ec33631c1974..99ac562ee7b1d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier.php @@ -19,6 +19,7 @@ use Symfony\Component\Notifier\Channel\SmsChannel; use Symfony\Component\Notifier\Chatter; use Symfony\Component\Notifier\ChatterInterface; +use Symfony\Component\Notifier\EventListener\NotificationLoggerListener; use Symfony\Component\Notifier\EventListener\SendFailedMessageToNotifierListener; use Symfony\Component\Notifier\Message\ChatMessage; use Symfony\Component\Notifier\Message\SmsMessage; @@ -101,5 +102,8 @@ ->set('texter.messenger.sms_handler', MessageHandler::class) ->args([service('texter.transports')]) ->tag('messenger.message_handler', ['handles' => SmsMessage::class]) + + ->set('notifier.logger_notification_listener', NotificationLoggerListener::class) + ->tag('kernel.event_subscriber') ; }; diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_debug.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_debug.php new file mode 100644 index 0000000000000..16ae2ccb63e44 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_debug.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Component\Notifier\DataCollector\NotificationDataCollector; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('notifier.data_collector', NotificationDataCollector::class) + ->args([service('notifier.logger_notification_listener')]) + ; +};