Controller/SitemapController.php
protected function fillSitemap( $sitemap, $root, SearchResult $results )
    {
        foreach ( $results->searchHits as $searchHit )
        {
            /**
             * @var SearchHit $searchHit
             * @var Location  $location
             *
             */
            $location = $searchHit->valueObject;
            $url      = $this->generateUrl( $location, [ ], UrlGeneratorInterface::ABSOLUTE_URL );
            $modified = $location->contentInfo->modificationDate->format( "c" );
            $loc      = $sitemap->createElement( "loc", $url );
            $lastmod  = $sitemap->createElement( "lastmod", $modified );
            $urlElt   = $sitemap->createElement( "url" );
            $urlElt->appendChild( $loc );
            $urlElt->appendChild( $lastmod );
            $root->appendChild( $urlElt );
        }
    }
protected function fillSitemap( $sitemap, $root, SearchResult $results )
    {
        foreach ( $results->searchHits as $searchHit )
        {
            /**
             * @var SearchHit $searchHit
             * @var Location  $location
             *
             */
            $location = $searchHit->valueObject;
            $url      = $this->generateUrl( $location, [ ], UrlGeneratorInterface::ABSOLUTE_URL );
            $modified = $location->contentInfo->modificationDate->format( "c" );
            $loc      = $sitemap->createElement( "loc", $url );
            $lastmod  = $sitemap->createElement( "lastmod", $modified );
            $urlElt   = $sitemap->createElement( "url" );
            $urlElt->appendChild( $loc );
            $urlElt->appendChild( $lastmod );
            $root->appendChild( $urlElt );
        }
    }
protected function fillSitemap ( $ sitemap , $ root , SearchResult $ results ) { foreach ( $ results -> searchHits as $ searchHit ) { /**
             * @var SearchHit $searchHit
             * @var Location  $location
             *
             */ $ location = $ searchHit -> valueObject ; $ url = $ this -> generateUrl ( $ location , [ ] , UrlGeneratorInterface :: ABSOLUTE_URL ) ; $ modified = $ location -> contentInfo -> modificationDate -> format ( "c" ) ; $ loc = $ sitemap -> createElement ( "loc" , $ url ) ; $ lastmod = $ sitemap -> createElement ( "lastmod" , $ modified ) ; $ urlElt = $ sitemap -> createElement ( "url" ) ; $ urlElt -> appendChild ( $ loc ) ; $ urlElt -> appendChild ( $ lastmod ) ; $ root -> appendChild ( $ urlElt ) ; } }
Fill a sitemap

@param DOMDocument  $sitemap
@param DOMElement   $root
@param SearchResult $results
Fill a sitemap