diff --git a/src/Symfony/Framework/WebBundle/Controller.php b/src/Symfony/Framework/WebBundle/Controller.php index 1d8698c1a118..75fe3384f7fb 100644 --- a/src/Symfony/Framework/WebBundle/Controller.php +++ b/src/Symfony/Framework/WebBundle/Controller.php @@ -3,6 +3,7 @@ namespace Symfony\Framework\WebBundle; use Symfony\Components\DependencyInjection\ContainerInterface; +use Symfony\Components\RequestHandler\Response; /* * This file is part of the Symfony framework. @@ -96,14 +97,19 @@ public function renderView($view, array $parameters = array()) /** * Renders a view. * - * @param string $view The view name - * @param array $parameters An array of parameters to pass to the view + * @param string $view The view name + * @param array $parameters An array of parameters to pass to the view + * @param Response $response A response instance * * @return Response A Response instance */ - public function render($view, array $parameters = array()) + public function render($view, array $parameters = array(), Response $response = null) { - $response = $this->container->getResponseService(); + if (null === $response) + { + $response = $this->container->getResponseService(); + } + $response->setContent($this->container->getTemplatingService()->render($view, $parameters)); return $response;