Browse Source

[FrameworkBundle] Introduced a new Controller::getRequest() method to get the Request service from a controller.

Hugo Hamon 14 years ago
parent
commit
37b2df25bf
1 changed files with 10 additions and 0 deletions
  1. 10 0
      src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

+ 10 - 0
src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

@@ -137,6 +137,16 @@ class Controller extends ContainerAware
         return $this->get('form.factory')->createBuilder('form', $data, $options);
     }
 
+    /**
+     * Shortcut to return the request service.
+     *
+     * @return Symfony\Component\HttpFoundation\Request
+     */
+    public function getRequest()
+    {
+        return $this->get('request');
+    }
+
     /**
      * Shortcut to return the Doctrine Registry class
      *