src/EventListener/RedirectExceptionListener.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\EventListener;
  3. use App\Exception\RedirectException;
  4. use Symfony\Component\HttpKernel\Event\ExceptionEvent;
  5. class RedirectExceptionListener
  6. {
  7.     public function onKernelException(ExceptionEvent $event)
  8.     {
  9.         if ($event->getThrowable() instanceof RedirectException) {
  10.             $event->setResponse($event->getThrowable()->getRedirectResponse());
  11.         }
  12.     }
  13. }