From 52ae57563091c5e2f78424e579d95ec8f92470d1 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 5 Oct 2008 19:45:38 +0000 Subject: [PATCH] ENHANCEMENT Added Controller->getRequest() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63653 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/control/Controller.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/core/control/Controller.php b/core/control/Controller.php index 5c62954cd..a55a3fcd4 100644 --- a/core/control/Controller.php +++ b/core/control/Controller.php @@ -31,10 +31,17 @@ class Controller extends RequestHandlingData { protected $basicAuthEnabled = true; /** - * The HTTPResponse object that the controller returns + * @var HTTPResponse $response The response object that the controller returns. + * Set in {@link handleRequest()}. */ protected $response; + /** + * @var HTTPRequest $request The request object that the controller was called with. + * Set in {@link handleRequest()}. Useful to generate the {} + */ + protected $request; + /** * Default URL handlers - (Action)/(ID)/(OtherID) */ @@ -60,6 +67,7 @@ class Controller extends RequestHandlingData { $this->pushCurrent(); $this->urlParams = $request->allParams(); + $this->request = $request; $this->response = new HTTPResponse(); // Init @@ -151,6 +159,16 @@ class Controller extends RequestHandlingData { function getResponse() { return $this->response; } + + /** + * Get the request with which this controller was called (if any). + * Usually set in {@link handleRequest()}. + * + * @return HTTPRequest + */ + function getRequest() { + return $this->request; + } protected $baseInitCalled = false;