Hi I am trying to implement an XML navigation map which also contains all the routing information for the app, I have created the config handler below and changed factories.yml to use a custom routing class which extends sfPatternRouting. Both listed below, also the generated route cache file.
The routes seem to get loaded OK, but I get the error "Empty module and/or action after parsing the URL "/" (/)." Im not too sure what that signifies, can anybody spot what I am not doing right? Cheers dan. class gwProjectRouting extends sfPatternRouting { protected function getConfigFileName() { return sfContext::getInstance()->getConfigCache()->checkConfig('config/navtree.xml', true); } } class gwProjectRoutingConfigHandler extends sfConfigHandler { public function execute($configFiles) { $options = $this->getOptions(); unset($options['cache']); $dom = new DOMDocument("1.0"); $dom -> load($configFiles[0]); $xpath = new DOMXpath($dom); foreach ($xpath -> query('//node') as $i => $node) { if ($url = $node -> getAttribute('url')) { $params = array(); if ($node -> hasAttribute('module')) { $params['module'] = $node -> getAttribute('module'); } if ($node -> hasAttribute('action')) { $params['action'] = $node -> getAttribute('action'); } foreach ($xpath -> query('./param') as $param) { $params[$param -> getAttribute('name')] = $param -> getAttribute('value'); } $route_name = $node -> hasAttribute('name') ? $node -> getAttribute('name') : $i; $data[] = sprintf('$this -> routes["%s"] = new %s("%s",%s);', $route_name, 'sfRoute', $url, var_export($params, true)); $data[] = sprintf('$this -> routes["%s"] -> setDefaultOptions(%s);', $route_name, var_export($options, true)); $data[] = sprintf('$this -> routes["%s"] -> compile();', $route_name); } } $code = implode("\n", $data); return sprintf("<?php\n". "// auto-generated by gwProjectRoutingConfigHandler\n". "// date: %s\n%s\n", date('Y/m/d H:i:s'), $code ); } protected function getOptions() { $config = sfFactoryConfigHandler::getConfiguration(sfContext::getInstance()->getConfiguration()->getConfigPaths('config/factories.yml')); return $config['routing']['param']; } } <?php // auto-generated by gwProjectRoutingConfigHandler // date: 2010/07/14 00:37:15 $this -> routes["default"] = new sfRoute("/:module/:action",array ( )); $this -> routes["default"] -> setDefaultOptions(array ( 'load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, )); $this -> routes["default"] -> compile(); $this -> routes["2"] = new sfRoute("/audit",array ( 'module' => 'gwProjectAuditLog', 'action' => 'list', )); $this -> routes["2"] -> setDefaultOptions(array ( 'load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, )); $this -> routes["2"] -> compile(); $this -> routes["3"] = new sfRoute("/audit/:id",array ( 'module' => 'gwProjectAuditLog', 'action' => 'edit', )); $this -> routes["3"] -> setDefaultOptions(array ( 'load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, )); $this -> routes["3"] -> compile(); $this -> routes["4"] = new sfRoute("/profile",array ( 'module' => 'gwProjectUser', 'action' => 'profile', )); $this -> routes["4"] -> setDefaultOptions(array ( 'load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, )); $this -> routes["4"] -> compile(); $this -> routes["5"] = new sfRoute("/issues",array ( 'module' => 'gwProjectIssue', 'action' => 'list', )); $this -> routes["5"] -> setDefaultOptions(array ( 'load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, )); $this -> routes["5"] -> compile(); $this -> routes["6"] = new sfRoute("/issue/:issue_number",array ( 'module' => 'gwProjectIssue', 'action' => 'view', )); $this -> routes["6"] -> setDefaultOptions(array ( 'load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, )); $this -> routes["6"] -> compile(); $this -> routes["7"] = new sfRoute("/issue/task/create",array ( 'module' => 'gwProjectIssue', 'action' => 'createTask', )); $this -> routes["7"] -> setDefaultOptions(array ( 'load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, )); $this -> routes["7"] -> compile(); $this -> routes["8"] = new sfRoute("/reports",array ( 'module' => 'gwProjectReport', 'action' => 'index', )); $this -> routes["8"] -> setDefaultOptions(array ( 'load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, )); $this -> routes["8"] -> compile(); $this -> routes["13"] = new sfRoute("/search",array ( 'module' => 'gwProjectSearch', 'action' => 'search', )); $this -> routes["13"] -> setDefaultOptions(array ( 'load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, )); $this -> routes["13"] -> compile(); $this -> routes["14"] = new sfRoute("/login",array ( 'module' => 'sfGuardAuth', 'action' => 'signin', )); $this -> routes["14"] -> setDefaultOptions(array ( 'load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, )); $this -> routes["14"] -> compile(); $this -> routes["15"] = new sfRoute("/logout",array ( 'module' => 'sfGuardAuth', 'action' => 'signout', )); $this -> routes["15"] -> setDefaultOptions(array ( 'load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, )); $this -> routes["15"] -> compile(); $this -> routes["21"] = new sfRoute("entity/:id",array ( 'module' => 'gwProjectEntity', 'action' => 'view', )); $this -> routes["21"] -> setDefaultOptions(array ( 'load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, )); $this -> routes["21"] -> compile(); -- Dan Leech -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en