mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-01 05:39:10 +02:00
Controller::redirect now returns the resulting SS_HTTPResponse, allowing the function to better support chaining
This commit is contained in:
parent
b0e359ddb7
commit
7340da03a7
@ -458,6 +458,8 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect to the given URL.
|
* Redirect to the given URL.
|
||||||
|
*
|
||||||
|
* @return SS_HTTPResponse
|
||||||
*/
|
*/
|
||||||
public function redirect($url, $code=302) {
|
public function redirect($url, $code=302) {
|
||||||
if(!$this->response) $this->response = new SS_HTTPResponse();
|
if(!$this->response) $this->response = new SS_HTTPResponse();
|
||||||
@ -473,7 +475,7 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
|
|||||||
$url = Director::baseURL() . $url;
|
$url = Director::baseURL() . $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->redirect($url, $code);
|
return $this->response->redirect($url, $code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user