Called after the controller action is run and rendered.
public afterFilter ( Cake\Event\Event $event ) : |
||
$event | Cake\Event\Event | An Event instance |
return |
/** * Generate the response using the controller object. * * @param string $template The template to render. * @return void */ protected function _outputMessage($template) { try { $this->controller->render($template); $event = new Event('Controller.shutdown', $this->controller); $this->controller->afterFilter($event); $this->controller->response->send(); } catch (MissingViewException $e) { $attributes = $e->getAttributes(); if (isset($attributes['file']) && strpos($attributes['file'], 'error500') !== false) { $this->_outputMessageSafe('error500'); } else { $this->_outputMessage('error500'); } } catch (\Exception $e) { $this->_outputMessageSafe('error500'); } }
/** * Generate the response using the controller object. * * @param string $template The template to render. * @return \Cake\Network\Response A response object that can be sent. */ protected function _outputMessage($template) { try { $this->controller->render($template); $event = new Event('Controller.shutdown', $this->controller); $this->controller->afterFilter($event); return $this->controller->response; } catch (MissingTemplateException $e) { $attributes = $e->getAttributes(); if (isset($attributes['file']) && strpos($attributes['file'], 'error500') !== false) { return $this->_outputMessageSafe('error500'); } return $this->_outputMessage('error500'); } catch (MissingPluginException $e) { $attributes = $e->getAttributes(); if (isset($attributes['plugin']) && $attributes['plugin'] === $this->controller->plugin) { $this->controller->plugin = null; } return $this->_outputMessageSafe('error500'); } catch (\Exception $e) { return $this->_outputMessageSafe('error500'); } }