protected function processResponse($response) { if ($response instanceof Renderable) { // If the response is returned from the controller action is a View instance // and it is not marked as Layout, we will assume we want to render it on the // default templated environment, setup via the current controller properties. if (is_string($this->layout) && !$response instanceof Layout) { $response = Template::make($this->layout, $this->template)->with('content', $response); } // Create a proper Response instance. $response = new Response($response->render(), 200, array('Content-Type' => 'text/html')); } if (!$response instanceof SymfonyResponse) { $response = new Response($response); } return $response; }
/** * Create from the given result a Response instance and send it. * * @param mixed $response * * @return \Symfony\Component\HttpFoundation\Response */ protected function processResponse($response) { if ($response instanceof Renderable) { // If the response which is returned from the called Action is a Renderable instance, // we will assume we want to render it using the Controller's templated environment. if (is_string($this->layout) && !empty($this->layout) && !$response instanceof Layout) { $response = Template::make($this->layout, array(), $this->template)->with('content', $response); } // Create a proper Response instance. $response = new Response($response->render(), 200, array('Content-Type' => 'text/html')); } // If the response is not a instance of Symfony Response, create a proper one. if (!$response instanceof SymfonyResponse) { $response = new Response($response); } return $response; }