Ejemplo n.º 1
0
 /**
  * Listen to the "route" event and attempt to route the request
  *
  * If no matches are returned, triggers "dispatch.error" in order to
  * create a 404 response.
  *
  * Seeds the event with the route match on completion.
  *
  * @param  MvcEvent $e
  * @return null|Router\RouteMatch
  */
 public function onRoute($e)
 {
     $target = $e->getTarget();
     $request = $e->getRequest();
     //$router     = $e->getRouter();
     //$routeMatch = $router->match($request);
     //if (!$routeMatch instanceof Router\RouteMatch) {
     //    $e->setError(Application::ERROR_ROUTER_NO_MATCH);
     //    $results = $target->getEventManager()->trigger(MvcEvent::EVENT_DISPATCH_ERROR, $e);
     //    if (count($results)) {
     //        return $results->last();
     //    }
     //    return $e->getParams();
     //}
     //$e->setRouteMatch($routeMatch);
     //return $routeMatch;
 }
Ejemplo n.º 2
0
 /**
  * Complete the request
  *
  * Triggers "render" and "finish" events, and returns response from
  * event object.
  *
  * @param  MvcEvent $event
  * @return Application
  */
 protected function completeRequest(MvcEvent $event)
 {
     $events = $this->events;
     $event->setTarget($this);
     $events->trigger(MvcEvent::EVENT_RENDER, $event);
     $events->trigger(MvcEvent::EVENT_FINISH, $event);
     return $this;
 }