public function buildContentDomainObject(
        SPIContent $spiContent,
        ContentType $contentType,
        array $prioritizedLanguages = [],
        string $fieldAlwaysAvailableLanguage = null
    ) {
        $prioritizedFieldLanguageCode = null;
        if (!empty($prioritizedLanguages)) {
            $availableFieldLanguageMap = array_fill_keys($spiContent->versionInfo->languageCodes, true);
            foreach ($prioritizedLanguages as $prioritizedLanguage) {
                if (isset($availableFieldLanguageMap[$prioritizedLanguage])) {
                    $prioritizedFieldLanguageCode = $prioritizedLanguage;
                    break;
                }
            }
        }

        return new Content(
            array(
                'internalFields' => $this->buildDomainFields($spiContent->fields, $contentType, $prioritizedLanguages, $fieldAlwaysAvailableLanguage),
                'versionInfo' => $this->buildVersionInfoDomainObject($spiContent->versionInfo, $prioritizedLanguages),
                'contentType' => $contentType,
                'prioritizedFieldLanguageCode' => $prioritizedFieldLanguageCode,
            )
        );
    }
public function buildContentDomainObject(
        SPIContent $spiContent,
        ContentType $contentType,
        array $prioritizedLanguages = [],
        string $fieldAlwaysAvailableLanguage = null
    ) {
        $prioritizedFieldLanguageCode = null;
        if (!empty($prioritizedLanguages)) {
            $availableFieldLanguageMap = array_fill_keys($spiContent->versionInfo->languageCodes, true);
            foreach ($prioritizedLanguages as $prioritizedLanguage) {
                if (isset($availableFieldLanguageMap[$prioritizedLanguage])) {
                    $prioritizedFieldLanguageCode = $prioritizedLanguage;
                    break;
                }
            }
        }

        return new Content(
            array(
                'internalFields' => $this->buildDomainFields($spiContent->fields, $contentType, $prioritizedLanguages, $fieldAlwaysAvailableLanguage),
                'versionInfo' => $this->buildVersionInfoDomainObject($spiContent->versionInfo, $prioritizedLanguages),
                'contentType' => $contentType,
                'prioritizedFieldLanguageCode' => $prioritizedFieldLanguageCode,
            )
        );
    }
public function buildContentDomainObject ( SPIContent $ spiContent , ContentType $ contentType , array $ prioritizedLanguages = [ ] , string $ fieldAlwaysAvailableLanguage = null ) { $ prioritizedFieldLanguageCode = null ; if ( ! empty ( $ prioritizedLanguages ) ) { $ availableFieldLanguageMap = array_fill_keys ( $ spiContent -> versionInfo -> languageCodes , true ) ; foreach ( $ prioritizedLanguages as $ prioritizedLanguage ) { if ( isset ( $ availableFieldLanguageMap [ $ prioritizedLanguage ] ) ) { $ prioritizedFieldLanguageCode = $ prioritizedLanguage ; break ; } } } return new Content ( array ( 'internalFields' => $ this -> buildDomainFields ( $ spiContent -> fields , $ contentType , $ prioritizedLanguages , $ fieldAlwaysAvailableLanguage ) , 'versionInfo' => $ this -> buildVersionInfoDomainObject ( $ spiContent -> versionInfo , $ prioritizedLanguages ) , 'contentType' => $ contentType , 'prioritizedFieldLanguageCode' => $ prioritizedFieldLanguageCode , ) ) ; }
Builds a Content domain object from value object returned from persistence.

@param \eZ\Publish\SPI\Persistence\Content $spiContent
@param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType
@param array $prioritizedLanguages Prioritized language codes to filter fields on
@param string|null $fieldAlwaysAvailableLanguage Language code fallback if a given field is not found in $prioritizedLanguages

@return \eZ\Publish\Core\Repository\Values\Content\Content
Builds a Content domain object from value object returned from persistence .