/**
  * Run the shutdown events.
  *
  * Triggers the afterFilter and afterDispatch events.
  *
  * @return \Cake\Network\Response The response to serve.
  */
 protected function _shutdown()
 {
     $this->controller->dispatchEvent('Controller.shutdown');
     $dispatcher = DispatcherFactory::create();
     $args = ['request' => $this->controller->request, 'response' => $this->controller->response];
     $result = $dispatcher->dispatchEvent('Dispatcher.afterDispatch', $args);
     return $result->data['response'];
 }
Esempio n. 2
0
 /**
  * Run the shutdown events.
  *
  * Triggers the afterFilter and afterDispatch events.
  *
  * @return \Cake\Network\Response The response to serve.
  */
 protected function _shutdown()
 {
     $this->controller->dispatchEvent('Controller.shutdown');
     $dispatcher = DispatcherFactory::create();
     $eventManager = $dispatcher->eventManager();
     foreach ($dispatcher->filters() as $filter) {
         $eventManager->attach($filter);
     }
     $args = ['request' => $this->controller->request, 'response' => $this->controller->response];
     $result = $dispatcher->dispatchEvent('Dispatcher.afterDispatch', $args);
     return $result->data['response'];
 }