Bundle/SitemapBundle/Controller/SitemapController.php
public function xmlAction(Request $request)
    {
        $redis = $this->get('snc_redis.victoire_client');
        $locale = $request->getLocale();
        $cacheKey = "sitemap.$locale";

        $pages = $redis->get($cacheKey);
        if ($pages === null) {
            $exportHandler = $this->get('victoire_sitemap.export.handler');

            $pages = $exportHandler->serialize(
                $exportHandler->handle($locale)
            );
        }

        return $this->render('VictoireSitemapBundle:Sitemap:sitemap.xml.twig', [
            'pages' => json_decode($pages),
        ]);
    }
public function xmlAction(Request $request)
    {
        $redis = $this->get('snc_redis.victoire_client');
        $locale = $request->getLocale();
        $cacheKey = "sitemap.$locale";

        $pages = $redis->get($cacheKey);
        if ($pages === null) {
            $exportHandler = $this->get('victoire_sitemap.export.handler');

            $pages = $exportHandler->serialize(
                $exportHandler->handle($locale)
            );
        }

        return $this->render('VictoireSitemapBundle:Sitemap:sitemap.xml.twig', [
            'pages' => json_decode($pages),
        ]);
    }
public function xmlAction ( Request $ request ) { $ redis = $ this -> get ( 'snc_redis.victoire_client' ) ; $ locale = $ request -> getLocale ( ) ; $ cacheKey = "sitemap.$locale" ; $ pages = $ redis -> get ( $ cacheKey ) ; if ( $ pages === null ) { $ exportHandler = $ this -> get ( 'victoire_sitemap.export.handler' ) ; $ pages = $ exportHandler -> serialize ( $ exportHandler -> handle ( $ locale ) ) ; } return $ this -> render ( 'VictoireSitemapBundle:Sitemap:sitemap.xml.twig' , [ 'pages' => json_decode ( $ pages ) , ] ) ; }
Get Sitemap as XML.

@Route(".{_format}", name="victoire_sitemap_xml", Requirements={"_format" = "xml"})

@return Response
Get Sitemap as XML .