Created
May 6, 2013 14:51
-
-
Save EuphoryX1/5525643 to your computer and use it in GitHub Desktop.
Symfony2 custom exception event
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parameters: | |
euphory.exceptlistener.class: Euphory\StoreBundle\Event\WebExceptionListener | |
services: | |
euphory.exceptlistener: | |
class: %euphory.exceptlistener.class% | |
arguments: [@mailer,@templating,@logger] | |
tags: | |
- { name: kernel.event_listener, event: kernel.exception, method: onKernelException, priority: 200 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Euphory\StoreBundle\Event; | |
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
class WebExceptionListener implements EventSubscriberInterface | |
{ | |
/** | |
* @var \Swift_Mailer | |
*/ | |
protected $mailer; | |
/** | |
* @var \Symfony\Bundle\TwigBundle\Debug\TimedTwigEngine | |
*/ | |
protected $templating; | |
/** | |
* @var \Monolog\Logger | |
*/ | |
protected $logger; | |
public function __construct($mailer, $templating, $logger) | |
{ | |
$this->mailer = $mailer; | |
$this->templating = $templating; | |
$this->logger = $logger; | |
} | |
public function onKernelException(GetResponseForExceptionEvent $event) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment