Пример #1
0
 public function checkRedirectException(GetResponseForExceptionEvent $event)
 {
     $exception = $event->getException();
     if ($exception instanceof ExceptionRedirectException) {
         $response = RedirectResponse::create($exception->getUrl(), $exception->getStatusCode());
         $event->setResponse($response);
     } elseif ($exception instanceof AuthenticationException) {
         // Redirect to the login template
         $response = RedirectResponse::create($this->urlManager->viewUrl($exception->getLoginTemplate()));
         $event->setResponse($response);
     }
 }