public function loadContentListByContentInfo(
        array $contentInfoList,
        array $languages = [],
        $useAlwaysAvailable = true
    ) {
        $loadAllLanguages = $languages === Language::ALL;
        $contentIds = [];
        $contentTypeIds = [];
        $translations = $languages;
        foreach ($contentInfoList as $contentInfo) {
            $contentIds[] = $contentInfo->id;
            $contentTypeIds[] = $contentInfo->contentTypeId;
            // Unless we are told to load all languages, we add main language to translations so they are loaded too
            // Might in some case load more languages then intended, but prioritised handling will pick right one
            if (!$loadAllLanguages && $useAlwaysAvailable && $contentInfo->alwaysAvailable) {
                $translations[] = $contentInfo->mainLanguageCode;
            }
        }

        $contentList = [];
        $translations = array_unique($translations);
        $spiContentList = $this->persistenceHandler->contentHandler()->loadContentList(
            $contentIds,
            $translations
        );
        $contentTypeList = $this->repository->getContentTypeService()->loadContentTypeList(
            array_unique($contentTypeIds),
            $languages
        );
        foreach ($spiContentList as $contentId => $spiContent) {
            $contentInfo = $spiContent->versionInfo->contentInfo;
            $contentList[$contentId] = $this->domainMapper->buildContentDomainObject(
                $spiContent,
                $contentTypeList[$contentInfo->contentTypeId],
                $languages,
                $contentInfo->alwaysAvailable ? $contentInfo->mainLanguageCode : null
            );
        }

        return $contentList;
    }
public function loadContentListByContentInfo(
        array $contentInfoList,
        array $languages = [],
        $useAlwaysAvailable = true
    ) {
        $loadAllLanguages = $languages === Language::ALL;
        $contentIds = [];
        $contentTypeIds = [];
        $translations = $languages;
        foreach ($contentInfoList as $contentInfo) {
            $contentIds[] = $contentInfo->id;
            $contentTypeIds[] = $contentInfo->contentTypeId;
            // Unless we are told to load all languages, we add main language to translations so they are loaded too
            // Might in some case load more languages then intended, but prioritised handling will pick right one
            if (!$loadAllLanguages && $useAlwaysAvailable && $contentInfo->alwaysAvailable) {
                $translations[] = $contentInfo->mainLanguageCode;
            }
        }

        $contentList = [];
        $translations = array_unique($translations);
        $spiContentList = $this->persistenceHandler->contentHandler()->loadContentList(
            $contentIds,
            $translations
        );
        $contentTypeList = $this->repository->getContentTypeService()->loadContentTypeList(
            array_unique($contentTypeIds),
            $languages
        );
        foreach ($spiContentList as $contentId => $spiContent) {
            $contentInfo = $spiContent->versionInfo->contentInfo;
            $contentList[$contentId] = $this->domainMapper->buildContentDomainObject(
                $spiContent,
                $contentTypeList[$contentInfo->contentTypeId],
                $languages,
                $contentInfo->alwaysAvailable ? $contentInfo->mainLanguageCode : null
            );
        }

        return $contentList;
    }
public function loadContentListByContentInfo ( array $ contentInfoList , array $ languages = [ ] , $ useAlwaysAvailable = true ) { $ loadAllLanguages = $ languages === Language :: ALL ; $ contentIds = [ ] ; $ contentTypeIds = [ ] ; $ translations = $ languages ; foreach ( $ contentInfoList as $ contentInfo ) { $ contentIds [ ] = $ contentInfo -> id ; $ contentTypeIds [ ] = $ contentInfo -> contentTypeId ; // Unless we are told to load all languages, we add main language to translations so they are loaded too // Might in some case load more languages then intended, but prioritised handling will pick right one if ( ! $ loadAllLanguages && $ useAlwaysAvailable && $ contentInfo -> alwaysAvailable ) { $ translations [ ] = $ contentInfo -> mainLanguageCode ; } } $ contentList = [ ] ; $ translations = array_unique ( $ translations ) ; $ spiContentList = $ this -> persistenceHandler -> contentHandler ( ) -> loadContentList ( $ contentIds , $ translations ) ; $ contentTypeList = $ this -> repository -> getContentTypeService ( ) -> loadContentTypeList ( array_unique ( $ contentTypeIds ) , $ languages ) ; foreach ( $ spiContentList as $ contentId => $ spiContent ) { $ contentInfo = $ spiContent -> versionInfo -> contentInfo ; $ contentList [ $ contentId ] = $ this -> domainMapper -> buildContentDomainObject ( $ spiContent , $ contentTypeList [ $ contentInfo -> contentTypeId ] , $ languages , $ contentInfo -> alwaysAvailable ? $ contentInfo -> mainLanguageCode : null ) ; } return $ contentList ; }
Bulk-load Content items by the list of ContentInfo Value Objects.

Note: it does not throw exceptions on load, just ignores erroneous Content item.
Moreover, since the method works on pre-loaded ContentInfo list, it is assumed that user is
allowed to access every Content on the list.

@param \eZ\Publish\API\Repository\Values\Content\ContentInfo[] $contentInfoList
@param string[] $languages A language priority, filters returned fields and is used as prioritized language code on
returned value object. If not given all languages are returned.
@param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true,
unless all languages have been asked for.

@return \eZ\Publish\API\Repository\Values\Content\Content[] list of Content items with Content Ids as keys
Bulk - load Content items by the list of ContentInfo Value Objects .