private function dispatchController() { // create controller $controller = $this->newController(); // EVENT onController $controllerEvent = new ControllerEvent($controller); $eventDispatcher = $this->getEventDispatcher(); $eventDispatcher->dispatch(MvcEvent::ON_CONTROLLER, $controllerEvent); if ($controllerEvent->hasResponse()) { $this->response = $controllerEvent->getResponse(); if ($this->request->isDispatched()) { return; } } $controller = $controllerEvent->getController(); $this->request->setDispatched(true); // dispatch controller action $controller->dispatch(); $this->response = $controller->getResponse(); }