示例#1
0
    /**
     * Returns all language codes used in given $fields.
     *
     * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if no field value exists in initial language
     *
     * @param \eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct $contentUpdateStruct
     * @param \eZ\Publish\API\Repository\Values\Content\Content $content
     *
     * @return array
     */
    protected function getLanguageCodesForUpdate( APIContentUpdateStruct $contentUpdateStruct, APIContent $content )
    {
        if ( $contentUpdateStruct->initialLanguageCode !== null )
        {
            $this->persistenceHandler->contentLanguageHandler()->loadByLanguageCode(
                $contentUpdateStruct->initialLanguageCode
            );
        }
        else
        {
            $contentUpdateStruct->initialLanguageCode = $content->contentInfo->mainLanguageCode;
        }

        $languageCodes = array_fill_keys( $content->versionInfo->languageCodes, true );
        $languageCodes[$contentUpdateStruct->initialLanguageCode] = true;

        foreach ( $contentUpdateStruct->fields as $field )
        {
            if ( $field->languageCode === null || isset( $languageCodes[$field->languageCode] ) )
            {
                continue;
            }

            $this->persistenceHandler->contentLanguageHandler()->loadByLanguageCode(
                $field->languageCode
            );
            $languageCodes[$field->languageCode] = true;
        }

        return array_keys( $languageCodes );
    }
示例#2
0
 /**
  * Get RelationProcessor
  *
  * @access private Internal service for the Core Services
  *
  * @todo Move out from this & other repo instances when services becomes proper services in DIC terms using factory.
  *
  * @return \eZ\Publish\Core\Repository\DomainMapper
  */
 protected function getDomainMapper()
 {
     if ($this->domainMapper !== null) {
         return $this->domainMapper;
     }
     $this->domainMapper = new DomainMapper($this, $this->persistenceHandler->contentTypeHandler(), $this->persistenceHandler->contentLanguageHandler());
     return $this->domainMapper;
 }
示例#3
0
 /**
  * Get RelationProcessor.
  *
  *
  * @todo Move out from this & other repo instances when services becomes proper services in DIC terms using factory.
  *
  * @return \eZ\Publish\Core\Repository\Helper\DomainMapper
  */
 protected function getDomainMapper()
 {
     if ($this->domainMapper !== null) {
         return $this->domainMapper;
     }
     $this->domainMapper = new Helper\DomainMapper($this->persistenceHandler->contentHandler(), $this->persistenceHandler->locationHandler(), $this->persistenceHandler->contentTypeHandler(), $this->persistenceHandler->contentLanguageHandler(), $this->getFieldTypeRegistry());
     return $this->domainMapper;
 }