/** * Routes the request through the router with assigned routes * * @param array $routes */ public function dispatch() { Pfw_PluginManager::execPreRoute(); $script_url = $_SERVER['REQUEST_URI']; if (false !== ($qpos = strpos($script_url, '?'))) { $script_url = substr($script_url, 0, $qpos); } $route_params = $this->getRouter()->route($script_url); Pfw_Request::setParams($route_params); if (empty($route_params)) { Pfw_Loader::loadClass('Pfw_Exception_NoRoute'); throw new Pfw_Exception_NoRoute("Failed to find matching route for url path: '{$script_url}'"); } Pfw_PluginManager::execPostRoute(); $module = isset($route_params['module']) ? $route_params['module'] : null; Pfw_PluginManager::execPreMap(); $cont_action = $this->getMapper()->map($route_params['controller'], $route_params['action'], $module); Pfw_PluginManager::execPostMap(); Pfw_PluginManager::execPreDispatch(); $controller = $cont_action['controller']; $method = $cont_action['method']; $controller->_setFrontController($this); $this->controller = $controller; $controller->{$method}(); Pfw_PluginManager::execPostDispatch(); }