mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Removing response injection into controller from dispatcher.
Modifying Dispatcher to use accessor method.
This commit is contained in:
parent
7221f9c3b9
commit
91c9c74274
1 changed files with 8 additions and 13 deletions
|
@ -78,10 +78,9 @@ class Dispatcher {
|
|||
public $request = null;
|
||||
|
||||
/**
|
||||
* The response object
|
||||
* Response object used for asset/cached responses.
|
||||
*
|
||||
* @var CakeResponse
|
||||
* @access public
|
||||
*/
|
||||
public $response = null;
|
||||
|
||||
|
@ -195,19 +194,20 @@ class Dispatcher {
|
|||
'base' => $request->base
|
||||
)));
|
||||
}
|
||||
$output =& call_user_func_array(array(&$controller, $request->params['action']), $request->params['pass']);
|
||||
$result =& call_user_func_array(array(&$controller, $request->params['action']), $request->params['pass']);
|
||||
$response = $controller->getResponse();
|
||||
|
||||
if ($controller->autoRender) {
|
||||
$controller->render();
|
||||
} elseif ($this->response->body() === null) {
|
||||
$this->response->body($output);
|
||||
} elseif ($response->body() === null) {
|
||||
$response->body($result);
|
||||
}
|
||||
$controller->shutdownProcess();
|
||||
|
||||
if (isset($request->params['return'])) {
|
||||
return $this->response->body();
|
||||
return $response->body();
|
||||
}
|
||||
$this->response->send();
|
||||
$response->send();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -256,14 +256,9 @@ class Dispatcher {
|
|||
if (!$ctrlClass) {
|
||||
return $controller;
|
||||
}
|
||||
if (!$this->response) {
|
||||
$this->response = new CakeResponse(array(
|
||||
'charset' => Configure::read('App.encoding')
|
||||
));
|
||||
}
|
||||
$ctrlClass .= 'Controller';
|
||||
if (class_exists($ctrlClass)) {
|
||||
$controller = new $ctrlClass($this->request, $this->response);
|
||||
$controller = new $ctrlClass($this->request);
|
||||
}
|
||||
return $controller;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue