public function onKernelResponse(FilterResponseEvent $event)
    {
        $request = $event->getRequest();
        $id = $request->get($this->ajaxId);

        if (!$request->isXmlHttpRequest() || null === $id) {
            return;
        }

        if (!isset($this->ajaxEvents[$id])) {
            $event->setResponse(new Response());

            return;
        }

        $ajaxEvent = $this->ajaxEvents[$id];

        $request->setRequestFormat($ajaxEvent->getFormat());
        $event->setResponse($ajaxEvent->generateResponse());
        $event->stopPropagation();
    }
public function onKernelResponse(FilterResponseEvent $event)
    {
        $request = $event->getRequest();
        $id = $request->get($this->ajaxId);

        if (!$request->isXmlHttpRequest() || null === $id) {
            return;
        }

        if (!isset($this->ajaxEvents[$id])) {
            $event->setResponse(new Response());

            return;
        }

        $ajaxEvent = $this->ajaxEvents[$id];

        $request->setRequestFormat($ajaxEvent->getFormat());
        $event->setResponse($ajaxEvent->generateResponse());
        $event->stopPropagation();
    }
public function onKernelResponse ( FilterResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ id = $ request -> get ( $ this -> ajaxId ) ; if ( ! $ request -> isXmlHttpRequest ( ) || null === $ id ) { return ; } if ( ! isset ( $ this -> ajaxEvents [ $ id ] ) ) { $ event -> setResponse ( new Response ( ) ) ; return ; } $ ajaxEvent = $ this -> ajaxEvents [ $ id ] ; $ request -> setRequestFormat ( $ ajaxEvent -> getFormat ( ) ) ; $ event -> setResponse ( $ ajaxEvent -> generateResponse ( ) ) ; $ event -> stopPropagation ( ) ; }
If the request is ajax, this method find the ajax event corresponding
with the ajax id request parameter.
She replace the response by the ajax response with the correct format.

@param FilterResponseEvent $event
If the request is ajax this method find the ajax event corresponding with the ajax id request parameter . She replace the response by the ajax response with the correct format .