public function buildVersionInfoDomainObject(SPIVersionInfo $spiVersionInfo, array $prioritizedLanguages = [])
    {
        // Map SPI statuses to API
        switch ($spiVersionInfo->status) {
            case SPIVersionInfo::STATUS_ARCHIVED:
                $status = APIVersionInfo::STATUS_ARCHIVED;
                break;

            case SPIVersionInfo::STATUS_PUBLISHED:
                $status = APIVersionInfo::STATUS_PUBLISHED;
                break;

            case SPIVersionInfo::STATUS_DRAFT:
            default:
                $status = APIVersionInfo::STATUS_DRAFT;
        }

        // Find prioritised language among names
        $prioritizedNameLanguageCode = null;
        foreach ($prioritizedLanguages as $prioritizedLanguage) {
            if (isset($spiVersionInfo->names[$prioritizedLanguage])) {
                $prioritizedNameLanguageCode = $prioritizedLanguage;
                break;
            }
        }

        return new VersionInfo(
            array(
                'id' => $spiVersionInfo->id,
                'versionNo' => $spiVersionInfo->versionNo,
                'modificationDate' => $this->getDateTime($spiVersionInfo->modificationDate),
                'creatorId' => $spiVersionInfo->creatorId,
                'creationDate' => $this->getDateTime($spiVersionInfo->creationDate),
                'status' => $status,
                'initialLanguageCode' => $spiVersionInfo->initialLanguageCode,
                'languageCodes' => $spiVersionInfo->languageCodes,
                'names' => $spiVersionInfo->names,
                'contentInfo' => $this->buildContentInfoDomainObject($spiVersionInfo->contentInfo),
                'prioritizedNameLanguageCode' => $prioritizedNameLanguageCode,
            )
        );
    }
public function buildVersionInfoDomainObject(SPIVersionInfo $spiVersionInfo, array $prioritizedLanguages = [])
    {
        // Map SPI statuses to API
        switch ($spiVersionInfo->status) {
            case SPIVersionInfo::STATUS_ARCHIVED:
                $status = APIVersionInfo::STATUS_ARCHIVED;
                break;

            case SPIVersionInfo::STATUS_PUBLISHED:
                $status = APIVersionInfo::STATUS_PUBLISHED;
                break;

            case SPIVersionInfo::STATUS_DRAFT:
            default:
                $status = APIVersionInfo::STATUS_DRAFT;
        }

        // Find prioritised language among names
        $prioritizedNameLanguageCode = null;
        foreach ($prioritizedLanguages as $prioritizedLanguage) {
            if (isset($spiVersionInfo->names[$prioritizedLanguage])) {
                $prioritizedNameLanguageCode = $prioritizedLanguage;
                break;
            }
        }

        return new VersionInfo(
            array(
                'id' => $spiVersionInfo->id,
                'versionNo' => $spiVersionInfo->versionNo,
                'modificationDate' => $this->getDateTime($spiVersionInfo->modificationDate),
                'creatorId' => $spiVersionInfo->creatorId,
                'creationDate' => $this->getDateTime($spiVersionInfo->creationDate),
                'status' => $status,
                'initialLanguageCode' => $spiVersionInfo->initialLanguageCode,
                'languageCodes' => $spiVersionInfo->languageCodes,
                'names' => $spiVersionInfo->names,
                'contentInfo' => $this->buildContentInfoDomainObject($spiVersionInfo->contentInfo),
                'prioritizedNameLanguageCode' => $prioritizedNameLanguageCode,
            )
        );
    }
public function buildVersionInfoDomainObject ( SPIVersionInfo $ spiVersionInfo , array $ prioritizedLanguages = [ ] ) { // Map SPI statuses to API switch ( $ spiVersionInfo -> status ) { case SPIVersionInfo :: STATUS_ARCHIVED : $ status = APIVersionInfo :: STATUS_ARCHIVED ; break ; case SPIVersionInfo :: STATUS_PUBLISHED : $ status = APIVersionInfo :: STATUS_PUBLISHED ; break ; case SPIVersionInfo :: STATUS_DRAFT : default : $ status = APIVersionInfo :: STATUS_DRAFT ; } // Find prioritised language among names $ prioritizedNameLanguageCode = null ; foreach ( $ prioritizedLanguages as $ prioritizedLanguage ) { if ( isset ( $ spiVersionInfo -> names [ $ prioritizedLanguage ] ) ) { $ prioritizedNameLanguageCode = $ prioritizedLanguage ; break ; } } return new VersionInfo ( array ( 'id' => $ spiVersionInfo -> id , 'versionNo' => $ spiVersionInfo -> versionNo , 'modificationDate' => $ this -> getDateTime ( $ spiVersionInfo -> modificationDate ) , 'creatorId' => $ spiVersionInfo -> creatorId , 'creationDate' => $ this -> getDateTime ( $ spiVersionInfo -> creationDate ) , 'status' => $ status , 'initialLanguageCode' => $ spiVersionInfo -> initialLanguageCode , 'languageCodes' => $ spiVersionInfo -> languageCodes , 'names' => $ spiVersionInfo -> names , 'contentInfo' => $ this -> buildContentInfoDomainObject ( $ spiVersionInfo -> contentInfo ) , 'prioritizedNameLanguageCode' => $ prioritizedNameLanguageCode , ) ) ; }
Builds a VersionInfo domain object from value object returned from persistence.

@param \eZ\Publish\SPI\Persistence\Content\VersionInfo $spiVersionInfo
@param array $prioritizedLanguages

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