public function indexAction(Request $request)
    {
        $registry = $this->get('ekyna_sitemap.provider_registry');
        $sitemaps = [];

        $lastUpdateDate = null;
        foreach($registry->getSitemaps() as $sitemap) {
            $providers = $registry->getProvidersBySitemap($sitemap);
            $sitemapLastUpdateDate = null;
            /** @var \Ekyna\Bundle\SitemapBundle\Provider\ProviderInterface $provider */
            foreach ($providers as $provider) {
                if (null === $sitemapLastUpdateDate || $sitemapLastUpdateDate < $provider->getLastUpdateDate()) {
                    $sitemapLastUpdateDate = $provider->getLastUpdateDate();
                }
            }
            $sitemaps[$sitemap] = $sitemapLastUpdateDate;
            if (null === $lastUpdateDate || $lastUpdateDate < $sitemapLastUpdateDate) {
                $lastUpdateDate = $sitemapLastUpdateDate;
            }
        }

        $response = new Response();
        $response->setLastModified($lastUpdateDate);
        $response->setPublic();
        if ($response->isNotModified($request)) {
            return $response;
        }
        $response->setMaxAge($this->container->getParameter('ekyna_sitemap.index_ttl'));
        $response->headers->add(['Content-Type' => 'application/xml; charset=UTF-8']);

        return $response->setContent($this->renderView('EkynaSitemapBundle:Sitemap:index.xml.twig', [
            'sitemaps' => $sitemaps,
        ]));
    }
public function indexAction(Request $request)
    {
        $registry = $this->get('ekyna_sitemap.provider_registry');
        $sitemaps = [];

        $lastUpdateDate = null;
        foreach($registry->getSitemaps() as $sitemap) {
            $providers = $registry->getProvidersBySitemap($sitemap);
            $sitemapLastUpdateDate = null;
            /** @var \Ekyna\Bundle\SitemapBundle\Provider\ProviderInterface $provider */
            foreach ($providers as $provider) {
                if (null === $sitemapLastUpdateDate || $sitemapLastUpdateDate < $provider->getLastUpdateDate()) {
                    $sitemapLastUpdateDate = $provider->getLastUpdateDate();
                }
            }
            $sitemaps[$sitemap] = $sitemapLastUpdateDate;
            if (null === $lastUpdateDate || $lastUpdateDate < $sitemapLastUpdateDate) {
                $lastUpdateDate = $sitemapLastUpdateDate;
            }
        }

        $response = new Response();
        $response->setLastModified($lastUpdateDate);
        $response->setPublic();
        if ($response->isNotModified($request)) {
            return $response;
        }
        $response->setMaxAge($this->container->getParameter('ekyna_sitemap.index_ttl'));
        $response->headers->add(['Content-Type' => 'application/xml; charset=UTF-8']);

        return $response->setContent($this->renderView('EkynaSitemapBundle:Sitemap:index.xml.twig', [
            'sitemaps' => $sitemaps,
        ]));
    }
public function indexAction ( Request $ request ) { $ registry = $ this -> get ( 'ekyna_sitemap.provider_registry' ) ; $ sitemaps = [ ] ; $ lastUpdateDate = null ; foreach ( $ registry -> getSitemaps ( ) as $ sitemap ) { $ providers = $ registry -> getProvidersBySitemap ( $ sitemap ) ; $ sitemapLastUpdateDate = null ; /** @var \Ekyna\Bundle\SitemapBundle\Provider\ProviderInterface $provider */ foreach ( $ providers as $ provider ) { if ( null === $ sitemapLastUpdateDate || $ sitemapLastUpdateDate < $ provider -> getLastUpdateDate ( ) ) { $ sitemapLastUpdateDate = $ provider -> getLastUpdateDate ( ) ; } } $ sitemaps [ $ sitemap ] = $ sitemapLastUpdateDate ; if ( null === $ lastUpdateDate || $ lastUpdateDate < $ sitemapLastUpdateDate ) { $ lastUpdateDate = $ sitemapLastUpdateDate ; } } $ response = new Response ( ) ; $ response -> setLastModified ( $ lastUpdateDate ) ; $ response -> setPublic ( ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ response -> setMaxAge ( $ this -> container -> getParameter ( 'ekyna_sitemap.index_ttl' ) ) ; $ response -> headers -> add ( [ 'Content-Type' => 'application/xml; charset=UTF-8' ] ) ; return $ response -> setContent ( $ this -> renderView ( 'EkynaSitemapBundle:Sitemap:index.xml.twig' , [ 'sitemaps' => $ sitemaps , ] ) ) ; }
Renders the sitemaps index.

@param Request $request
@return Response
Renders the sitemaps index .