Beispiel #1
0
 /**
  * @param          $route
  * @param Request  $request
  * @param Response $response
  */
 private function handleRoute($route, Request $request, Response $response)
 {
     $theRoute = $this->routeCollection->get($route['_route']);
     $controllerClass = $theRoute->getOption('karmaController');
     $action = $theRoute->getOption('karmaAction');
     $controller = new $controllerClass($this->dispatcher, $request, $response);
     /* @var $controller \ThinFrame\Karma\ViewController\AbstractController */
     unset($route['_route']);
     $this->dispatcher->trigger($controllerActionEvent = new ControllerActionEvent($request, $response, $controller, $action, $route));
     $actionResponse = $controller->trigger($action, $controllerActionEvent->getArguments());
     $this->dispatcher->trigger($controllerResponseEvent = new ControllerResponseEvent($request, $response, $controller, $action, $controllerActionEvent->getArguments(), $actionResponse));
     $response->setContent((string) $controllerResponseEvent->getActionResponse());
 }
 /**
  * Attache the entity manager to the controller
  *
  * @param ControllerActionEvent $event
  */
 public function onControllerAction(ControllerActionEvent $event)
 {
     $event->getController()->getServices()->set('entityManager', $this->entityManager);
 }