From 4b90392463296acc9ccf8f10649d7ac4937ae0f3 Mon Sep 17 00:00:00 2001 From: Benoit Jacquemont Date: Wed, 23 Oct 2013 11:10:31 +0200 Subject: [PATCH 1/2] Flush spool queue for console terminate as well --- EventListener/EmailSenderListener.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/EventListener/EmailSenderListener.php b/EventListener/EmailSenderListener.php index 8e4ef7e5..c4aa5957 100644 --- a/EventListener/EmailSenderListener.php +++ b/EventListener/EmailSenderListener.php @@ -15,6 +15,7 @@ use Symfony\Component\DependencyInjection\IntrospectableContainerInterface; use Symfony\Component\HttpKernel\Event\PostResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\Console\ConsoleEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -33,7 +34,7 @@ public function __construct(ContainerInterface $container) $this->container = $container; } - public function onKernelTerminate(PostResponseEvent $event) + public function onTerminate($event) { if (!$this->container->has('mailer')) { return; @@ -57,6 +58,9 @@ public function onKernelTerminate(PostResponseEvent $event) static public function getSubscribedEvents() { - return array(KernelEvents::TERMINATE => 'onKernelTerminate'); + return array( + KernelEvents::TERMINATE => 'onTerminate', + ConsoleEvents::TERMINATE => 'onTerminate' + ); } } From 4de0f631580e16b0880763007aa47562df86d4c1 Mon Sep 17 00:00:00 2001 From: Benoit Jacquemont Date: Wed, 23 Oct 2013 11:26:59 +0200 Subject: [PATCH 2/2] Cleanup use and unused parameter --- EventListener/EmailSenderListener.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/EventListener/EmailSenderListener.php b/EventListener/EmailSenderListener.php index c4aa5957..1cbb873d 100644 --- a/EventListener/EmailSenderListener.php +++ b/EventListener/EmailSenderListener.php @@ -13,7 +13,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\IntrospectableContainerInterface; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Console\ConsoleEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -34,7 +33,7 @@ public function __construct(ContainerInterface $container) $this->container = $container; } - public function onTerminate($event) + public function onTerminate() { if (!$this->container->has('mailer')) { return;