mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Dispatch afterDispatch event when exception is thrown
This commit is contained in:
parent
7763e5d6bc
commit
bddff7d2b0
1 changed files with 16 additions and 2 deletions
|
@ -20,9 +20,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
App::uses('Sanitize', 'Utility');
|
App::uses('Sanitize', 'Utility');
|
||||||
|
App::uses('Dispatcher', 'Routing');
|
||||||
App::uses('Router', 'Routing');
|
App::uses('Router', 'Routing');
|
||||||
App::uses('CakeResponse', 'Network');
|
|
||||||
App::uses('Controller', 'Controller');
|
App::uses('Controller', 'Controller');
|
||||||
|
App::uses('CakeRequest', 'Network');
|
||||||
|
App::uses('CakeResponse', 'Network');
|
||||||
|
App::uses('CakeEvent', 'Event');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exception Renderer.
|
* Exception Renderer.
|
||||||
|
@ -287,7 +290,7 @@ class ExceptionRenderer {
|
||||||
protected function _outputMessage($template) {
|
protected function _outputMessage($template) {
|
||||||
try {
|
try {
|
||||||
$this->controller->render($template);
|
$this->controller->render($template);
|
||||||
$this->controller->afterFilter();
|
$this->_shutdown();
|
||||||
$this->controller->response->send();
|
$this->controller->response->send();
|
||||||
} catch (MissingViewException $e) {
|
} catch (MissingViewException $e) {
|
||||||
$attributes = $e->getAttributes();
|
$attributes = $e->getAttributes();
|
||||||
|
@ -327,4 +330,15 @@ class ExceptionRenderer {
|
||||||
$this->controller->response->send();
|
$this->controller->response->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function _shutdown() {
|
||||||
|
$this->controller->afterFilter();
|
||||||
|
|
||||||
|
$Dispatcher = new Dispatcher();
|
||||||
|
$afterDispatchEvent = new CakeEvent('Dispatcher.afterDispatch', $Dispatcher, array(
|
||||||
|
'request' => $this->controller->request,
|
||||||
|
'response' => $this->controller->response
|
||||||
|
));
|
||||||
|
$Dispatcher->getEventManager()->dispatch($afterDispatchEvent);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue