protected function _initRouter() { $router = $this->getContainer()->frontcontroller->getRouter(); $defaultAdminRoute = Engine_Controller_Router_Route_ControllerPrefix::getInstance(new Zend_Config(array())); $router->addRoute('admin_default', $defaultAdminRoute); // Add module-configured routes $manifest = Zend_Registry::get('Engine_Manifest'); foreach ($manifest as $module => $config) { if (!isset($config['routes'])) { continue; } $router->addConfig(new Zend_Config($config['routes'])); } // Add user-defined routes $routesTable = Engine_Api::_()->getDbtable('routes', 'core'); $userConfig = array(); $stmt = $routesTable->select()->from($routesTable, array('name', 'config'))->order('order ASC')->query(); foreach ($stmt->fetchAll() as $row) { if (!empty($row['config'])) { $data = Zend_Json::decode($row['config']); if (is_array($data)) { $userConfig[$row['name']] = $data; } } } $router->addConfig(new Zend_Config($userConfig)); // Add default routes $router->addDefaultRoutes(); return $router; }
protected function _initRouter() { $router = $this->getContainer()->frontcontroller->getRouter(); $defaultAdminRoute = Engine_Controller_Router_Route_ControllerPrefix::getInstance(new Zend_Config(array())); $router->addRoute('admin_default', $defaultAdminRoute); // Add module-configured routes $manifest = Zend_Registry::get('Engine_Manifest'); foreach ($manifest as $module => $config) { if (!isset($config['routes'])) { continue; } $router->addConfig(new Zend_Config($config['routes'])); //$router->addConfig($config->routes); } // Add user-defined routes $routesTable = Engine_Api::_()->getDbtable('routes', 'core'); $userConfig = array(); foreach ($routesTable->fetchAll($routesTable->select()->order('order')) as $row) { $data = $row->config; $userConfig[$row->name] = $row->config; } $router->addConfig(new Zend_Config($userConfig)); return $router; }