public function onView(GetResponseForControllerResultEvent $event)
    {
        $result = $event->getControllerResult();

        if (!$result instanceof TemplateView) {
            return;
        }

        $response = $this->render($result);

        $event->setResponse($response);
    }
public function onView(GetResponseForControllerResultEvent $event)
    {
        $result = $event->getControllerResult();

        if (!$result instanceof TemplateView) {
            return;
        }

        $response = $this->render($result);

        $event->setResponse($response);
    }
public function onView ( GetResponseForControllerResultEvent $ event ) { $ result = $ event -> getControllerResult ( ) ; if ( ! $ result instanceof TemplateView ) { return ; } $ response = $ this -> render ( $ result ) ; $ event -> setResponse ( $ response ) ; }
If controller result is a TemplateView, convert it to a TemplateResponse.

@param GetResponseForControllerResultEvent $event
If controller result is a TemplateView convert it to a TemplateResponse .