Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Commit

Permalink
Flush spool queue for console terminate as well
Browse files Browse the repository at this point in the history
  • Loading branch information
BitOne committed Oct 23, 2013
1 parent 1c87809 commit 4b90392
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions EventListener/EmailSenderListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;
Expand All @@ -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'
);
}
}

3 comments on commit 4b90392

@0s1r1s
Copy link

@0s1r1s 0s1r1s commented on 4b90392 Nov 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The master branch of this Bundle is aliased for 2.2-dev-master. The Class ConsoleEvents is part of version 2.3 of the console component.

So this composer.json is ending with fatal errors:

"symfony/symfony":"2.2.*",
"symfony/swiftmailer-bundle": "2.2.*",

It's also default like this in the symfony-standard 2.2 branch composer.json

I just changed the swiftmailer version to 2.1.* to fix it temporary but I think there will be more people with the same issue?

@keesschepers
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am having the same issue. I am using symfony 2.2.*-dev.

@0s1r1s
Copy link

@0s1r1s 0s1r1s commented on 4b90392 Nov 12, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can have a look here for more information

Please sign in to comment.