Question

Now I use the bellow tutorial to create sitemap.xml of my project.

Xml sitemaps with Symfony2

To add URI (routes) of my project I should add them one bye one.

The question is:

"How to use symfony routing system to get all routing of symfony?"

Was it helpful?

Solution

I think this should do the job:

$routes = $this->getContainer()->get('router')->getRouteCollection();

foreach ($routes as $route) {
    // add to sitemap
}

This is the API info:

http://api.symfony.com/2.0/Symfony/Component/Routing/Router.html#method_getRouteCollection

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top