From f4cb3972d6724f867f347f4b7edb4c680663253f Mon Sep 17 00:00:00 2001 From: Gleb Sidora Date: Wed, 26 Mar 2014 14:15:36 +0200 Subject: [PATCH] added explicit swiftmailer flush after ConsoleEvents::TERMINATE --- DependencyInjection/MonologExtension.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DependencyInjection/MonologExtension.php b/DependencyInjection/MonologExtension.php index 4872d7fe..5e0d7247 100644 --- a/DependencyInjection/MonologExtension.php +++ b/DependencyInjection/MonologExtension.php @@ -316,7 +316,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler $message->addMethodCall('setTo', array($handler['to_email'])); $message->addMethodCall('setSubject', array($handler['subject'])); - if(isset($handler['mailer'])){ + if(isset($handler['mailer'])){ $mailer = $handler['mailer']; } else { $mailer = 'mailer'; @@ -341,6 +341,9 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler if (!$oldHandler) { $this->swiftMailerHandlers[] = $handlerId; $definition->addTag('kernel.event_listener', array('event' => 'kernel.terminate', 'method' => 'onKernelTerminate')); + if (method_exists($newHandlerClass, 'onCliTerminate')) { + $definition->addTag('kernel.event_listener', array('event' => 'console.terminate', 'method' => 'onCliTerminate')); + } } break;