ENHANCEMENT Added Controller->getRequest()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63653 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-10-05 19:45:38 +00:00
parent d53bbb0df1
commit 52ae575630

View File

@ -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
@ -152,6 +160,16 @@ class Controller extends RequestHandlingData {
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;
/**