문제

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?"

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top