public function onKernelException(GetResponseForExceptionEvent $event)
    {
        $exception = $event->getException();
        if (! $exception instanceof RedKiteCmsExceptionInterface) {
            return;
        }

        $message = $exception->getMessage();
        $jsonMessage = json_decode($message, true);
        if ( ! is_array($jsonMessage)) {
            $jsonMessage = array(
                'message' => $message,
            );
        }

        $parameters = array(
            'message' => '',
            'parameters' => array(),
            'domain' => 'RedKiteCmsBundle',
            'locale' => null,
        );
        $cleanedParameters = array_intersect_key($jsonMessage, $parameters);
        $parameters = array_merge($parameters, $cleanedParameters);

        $message = $this->translator->translate(
            $parameters["message"],
            $parameters["parameters"],
            $parameters["domain"],
            $parameters["locale"]
        );

        $response = $this->templating->renderResponse(
            'RedKiteCmsBundle:Dialog:dialog.html.twig',
            array(
                'message' => $message,
            )
        );
        $response->setStatusCode(404);
        $event->setResponse($response);
    }
public function onKernelException(GetResponseForExceptionEvent $event)
    {
        $exception = $event->getException();
        if (! $exception instanceof RedKiteCmsExceptionInterface) {
            return;
        }

        $message = $exception->getMessage();
        $jsonMessage = json_decode($message, true);
        if ( ! is_array($jsonMessage)) {
            $jsonMessage = array(
                'message' => $message,
            );
        }

        $parameters = array(
            'message' => '',
            'parameters' => array(),
            'domain' => 'RedKiteCmsBundle',
            'locale' => null,
        );
        $cleanedParameters = array_intersect_key($jsonMessage, $parameters);
        $parameters = array_merge($parameters, $cleanedParameters);

        $message = $this->translator->translate(
            $parameters["message"],
            $parameters["parameters"],
            $parameters["domain"],
            $parameters["locale"]
        );

        $response = $this->templating->renderResponse(
            'RedKiteCmsBundle:Dialog:dialog.html.twig',
            array(
                'message' => $message,
            )
        );
        $response->setStatusCode(404);
        $event->setResponse($response);
    }
public function onKernelException ( GetResponseForExceptionEvent $ event ) { $ exception = $ event -> getException ( ) ; if ( ! $ exception instanceof RedKiteCmsExceptionInterface ) { return ; } $ message = $ exception -> getMessage ( ) ; $ jsonMessage = json_decode ( $ message , true ) ; if ( ! is_array ( $ jsonMessage ) ) { $ jsonMessage = array ( 'message' => $ message , ) ; } $ parameters = array ( 'message' => '' , 'parameters' => array ( ) , 'domain' => 'RedKiteCmsBundle' , 'locale' => null , ) ; $ cleanedParameters = array_intersect_key ( $ jsonMessage , $ parameters ) ; $ parameters = array_merge ( $ parameters , $ cleanedParameters ) ; $ message = $ this -> translator -> translate ( $ parameters [ "message" ] , $ parameters [ "parameters" ] , $ parameters [ "domain" ] , $ parameters [ "locale" ] ) ; $ response = $ this -> templating -> renderResponse ( 'RedKiteCmsBundle:Dialog:dialog.html.twig' , array ( 'message' => $ message , ) ) ; $ response -> setStatusCode ( 404 ) ; $ event -> setResponse ( $ response ) ; }
Handles RedKiteCmsExceptionInterface exceptions

@param GetResponseForExceptionEvent $event
Handles RedKiteCmsExceptionInterface exceptions