private function processLocations(array $locations, ProgressBar $progressBar)
    {
        $contentList = $this->repository->sudo(
            function (Repository $repository) use ($locations) {
                $contentInfoList = array_map(
                    function (Location $location) {
                        return $location->contentInfo;
                    },
                    $locations
                );

                // load Content list in all languages
                return $repository->getContentService()->loadContentListByContentInfo(
                    $contentInfoList,
                    Language::ALL,
                    false
                );
            }
        );
        foreach ($locations as $location) {
            try {
                // ignore missing Content items
                if (!isset($contentList[$location->contentId])) {
                    continue;
                }

                $content = $contentList[$location->contentId];
                $this->repository->sudo(
                    function (Repository $repository) use ($location, $content) {
                        $repository->getURLAliasService()->refreshSystemUrlAliasesForLocation(
                            $location
                        );
                    }
                );
            } catch (Exception $e) {
                $contentInfo = $location->getContentInfo();
                $msg = sprintf(
                    'Failed processing location %d - [%d] %s (%s: %s)',
                    $location->id,
                    $contentInfo->id,
                    $contentInfo->name,
                    get_class($e),
                    $e->getMessage()
                );
                $this->logger->warning($msg);
                // in debug mode log full exception with a trace
                $this->logger->debug($e);
            } finally {
                $progressBar->advance(1);
            }
        }
    }
private function processLocations(array $locations, ProgressBar $progressBar)
    {
        $contentList = $this->repository->sudo(
            function (Repository $repository) use ($locations) {
                $contentInfoList = array_map(
                    function (Location $location) {
                        return $location->contentInfo;
                    },
                    $locations
                );

                // load Content list in all languages
                return $repository->getContentService()->loadContentListByContentInfo(
                    $contentInfoList,
                    Language::ALL,
                    false
                );
            }
        );
        foreach ($locations as $location) {
            try {
                // ignore missing Content items
                if (!isset($contentList[$location->contentId])) {
                    continue;
                }

                $content = $contentList[$location->contentId];
                $this->repository->sudo(
                    function (Repository $repository) use ($location, $content) {
                        $repository->getURLAliasService()->refreshSystemUrlAliasesForLocation(
                            $location
                        );
                    }
                );
            } catch (Exception $e) {
                $contentInfo = $location->getContentInfo();
                $msg = sprintf(
                    'Failed processing location %d - [%d] %s (%s: %s)',
                    $location->id,
                    $contentInfo->id,
                    $contentInfo->name,
                    get_class($e),
                    $e->getMessage()
                );
                $this->logger->warning($msg);
                // in debug mode log full exception with a trace
                $this->logger->debug($e);
            } finally {
                $progressBar->advance(1);
            }
        }
    }
private function processLocations ( array $ locations , ProgressBar $ progressBar ) { $ contentList = $ this -> repository -> sudo ( function ( Repository $ repository ) use ( $ locations ) { $ contentInfoList = array_map ( function ( Location $ location ) { return $ location -> contentInfo ; } , $ locations ) ; // load Content list in all languages return $ repository -> getContentService ( ) -> loadContentListByContentInfo ( $ contentInfoList , Language :: ALL , false ) ; } ) ; foreach ( $ locations as $ location ) { try { // ignore missing Content items if ( ! isset ( $ contentList [ $ location -> contentId ] ) ) { continue ; } $ content = $ contentList [ $ location -> contentId ] ; $ this -> repository -> sudo ( function ( Repository $ repository ) use ( $ location , $ content ) { $ repository -> getURLAliasService ( ) -> refreshSystemUrlAliasesForLocation ( $ location ) ; } ) ; } catch ( Exception $ e ) { $ contentInfo = $ location -> getContentInfo ( ) ; $ msg = sprintf ( 'Failed processing location %d - [%d] %s (%s: %s)' , $ location -> id , $ contentInfo -> id , $ contentInfo -> name , get_class ( $ e ) , $ e -> getMessage ( ) ) ; $ this -> logger -> warning ( $ msg ) ; // in debug mode log full exception with a trace $ this -> logger -> debug ( $ e ) ; } finally { $ progressBar -> advance ( 1 ) ; } } }
Process single results page of fetched Locations.

@param \eZ\Publish\API\Repository\Values\Content\Location[] $locations
@param \Symfony\Component\Console\Helper\ProgressBar $progressBar
Process single results page of fetched Locations .