Exemple #1
0
 private function route()
 {
     // EVENT onRoute
     $routeEvent = new RouteEvent($this->request);
     $eventDispatcher = $this->getEventDispatcher();
     $eventDispatcher->dispatch(MvcEvent::ON_ROUTE, $routeEvent);
     if ($routeEvent->hasResponse()) {
         $this->response = $routeEvent->getResponse();
         if ($this->request->isDispatched()) {
             return;
         }
     }
     // routes the request
     $route = $this->router->route($this->request);
     if ($route && $route->hasCallback()) {
         $this->dispatchRouteCallback($route);
         $this->request->setDispatched(true);
         return;
     }
     $this->dispatchController();
 }
Exemple #2
0
 /**
  * @param  string $routeName
  * @param  array  $params
  * @param  string $query
  * @param  string $asterisk
  * @return string
  */
 public function url($routeName, array $params = array(), $query = '', $asterisk = '')
 {
     return $this->router->getRoute($routeName)->getUrl($params, $query, $asterisk);
 }