瀏覽代碼

merged hhamon/controller_getrequest_method

Fabien Potencier 14 年之前
父節點
當前提交
aaf1300a20
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

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

@@ -138,6 +138,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 service.
      *