I am building an administration panel for a website and I would like to change the view called when a 404 exception occurs but only for the admin application. <
For some reason, this worked:
// get exception
$exception = $event->getException();
// get path
$path = $event->getRequest()->getPathInfo();
if ($exception->getStatusCode() == 404 && strpos($path, '/admin') === 0){
$templating = $this->container->get('templating');
$response = new Response($templating->render('CmtAdminBundle:Exception:error404.html.twig', array(
'exception' => $exception
)));
$event->setResponse($response);
}
Which is basically what I was doing earlier with a different syntax...
@dmirkitanov Anyway, thanks for your help !