Преглед изворни кода

[WebBundle] added a Response parameter to the send() method

Fabien Potencier пре 15 година
родитељ
комит
9cf78e637b
1 измењених фајлова са 10 додато и 4 уклоњено
  1. 10 4
      src/Symfony/Framework/WebBundle/Controller.php

+ 10 - 4
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 @@ class Controller
   /**
    * 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;