/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { // get routes $config = new sfRoutingConfigHandler(); $routes = $config->evaluate($this->configuration->getConfigPaths('config/routing.yml')); $routing = new sfPatternRouting($this->dispatcher); $routing->setRoutes($routes); $this->dispatcher->notify(new sfEvent($routing, 'routing.load_configuration')); $this->routes = $routing->getRoutes(); // display $arguments['name'] ? $this->outputRoute($arguments['application'], $arguments['name']) : $this->outputRoutes($arguments['application']); }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { // get routes $config = sfFactoryConfigHandler::getConfiguration($this->configuration->getConfigPaths('config/factories.yml')); $params = array_merge($config['routing']['param'], array('load_configuration' => false, 'logging' => false)); $config = new sfRoutingConfigHandler(); $routes = $config->evaluate($this->configuration->getConfigPaths('config/routing.yml')); $routing = new sfPatternRouting($this->dispatcher, null, $params); $routing->setRoutes($routes); $this->dispatcher->notify(new sfEvent($routing, 'routing.load_configuration')); $this->routes = $routing->getRoutes(); // display $arguments['name'] ? $this->outputRoute($arguments['application'], $arguments['name']) : $this->outputRoutes($arguments['application']); }
public static function retrieveAPIList($isWithI18n = true) { $result = array(); $context = sfContext::getInstance(); $config = new sfRoutingConfigHandler(); $currentApp = sfConfig::get('sf_app'); $i18n = $context->getI18n(); sfConfig::set('sf_app', 'api'); $routing = new sfPatternRouting($context->getEventDispatcher()); $routing->setRoutes($config->evaluate($context->getConfiguration()->getConfigPaths('config/routing.yml'))); sfConfig::set('sf_app', $currentApp); $context->getEventDispatcher()->notify(new sfEvent($routing, 'routing.load_configuration')); $routes = $routing->getRoutes(); foreach ($routes as $route) { if ($route instanceof opAPIRouteInterface) { $caption = $route->getAPICaption(); if ($isWithI18n) { $caption = $i18n->__($caption, null, 'api'); } $result[$route->getAPIName()] = $caption; } } return $result; }