Ejemplo n.º 1
0
 /**
  * Translate a version
  *
  * updates the destination version given in $translationInfo with the provided translated fields in $translationValues
  *
  * @example Examples/translation_5x.php
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update this version
  * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the given destination version is not a draft
  * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is set to an empty value
  * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $translationValues is not valid
  *
  * @param \eZ\Publish\API\Repository\Values\Content\TranslationInfo $translationInfo
  * @param \eZ\Publish\API\Repository\Values\Content\TranslationValues $translationValues
  * @param \eZ\Publish\API\Repository\Values\User\User $user If set, this user is taken as modifier of the version
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Content the content draft with the translated fields
  *
  * @since 5.0
  */
 public function translateVersion( TranslationInfo $translationInfo, TranslationValues $translationValues, User $user = null )
 {
     $returnValue = $this->service->translateVersion( $translationInfo, $translationValues, $user );
     $this->signalDispatcher->emit(
         new TranslateVersionSignal(
             array(
                 'contentId' => $translationInfo->srcVersionInfo->contentInfo->id,
                 'versionNo' => $translationInfo->srcVersionInfo->versionNo,
                 'userId' => ( $user !== null ? $user->id : null ),
             )
         )
     );
     return $returnValue;
 }