/**
  * Copy Type incl fields and groupIds to a new Type object
  *
  * New Type will have $userId as creator / modifier, created / modified should be updated with current time,
  * updated remoteId and identifier should be appended with '_' + unique string.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to copy a content type
  *
  * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType
  * @param \eZ\Publish\API\Repository\Values\User\User $user if null the current user is used
  *
  * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
  */
 public function copyContentType(ContentType $contentType, User $user = null)
 {
     $returnValue = $this->service->copyContentType($contentType, $user);
     $this->signalDispatcher->emit(new CopyContentTypeSignal(array('contentTypeId' => $contentType->id, 'userId' => $user !== null ? $user->id : null)));
     return $returnValue;
 }
Ejemplo n.º 2
0
 /**
  * Copies a content type. The identifier of the copy
  * is changed to copy_of_<identifier> and a new remoteId is generated.
  *
  * @param $contentTypeId
  *
  * @return \eZ\Publish\Core\REST\Server\Values\ResourceCreated
  */
 public function copyContentType($contentTypeId)
 {
     $copiedContentType = $this->contentTypeService->copyContentType($this->contentTypeService->loadContentType($contentTypeId));
     return new Values\ResourceCreated($this->router->generate('ezpublish_rest_loadContentType', array('contentTypeId' => $copiedContentType->id)));
 }