php - Can I dynamicaly generate routes from MyBundle/Resources/config/routing.yml file in Symfony2? -


as in question above. how can access route names mybundle/resources/config/routing.yml file , stick them array. want use regular expresions pull array values patern , use them generate navigation menu. clues ?

the easiest way use router instance. has method called getroutecollection returns, well, routecollection. object has information need every route application makes.

$router = $this->get('router'); // service name $collection = $router->getroutecollection(); // routes foreach ( $collection->all() $name => $route ) { // route instance     // regular expression matching here } 

for further information can source @ symfony\component\routing.

if want create routes depending on other routes, replace , extend router class, override above method.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -