eZ\Publish\Core\Repository\ContentTypeService::updateContentTypeDraft PHP Method

updateContentTypeDraft() public method

Does not update fields (fieldDefinitions), use {@link updateFieldDefinition()} to update them.
public updateContentTypeDraft ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft, eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct $contentTypeUpdateStruct )
$contentTypeDraft eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft
$contentTypeUpdateStruct eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct
    public function updateContentTypeDraft(APIContentTypeDraft $contentTypeDraft, ContentTypeUpdateStruct $contentTypeUpdateStruct)
    {
        if ($this->repository->hasAccess('class', 'update') !== true) {
            throw new UnauthorizedException('ContentType', 'update');
        }
        try {
            $loadedContentTypeDraft = $this->loadContentTypeDraft($contentTypeDraft->id);
        } catch (APINotFoundException $e) {
            throw new InvalidArgumentException('$contentTypeDraft', 'There is no ContentType draft assigned to the authenticated user', $e);
        }
        if ($contentTypeUpdateStruct->identifier !== null && $contentTypeUpdateStruct->identifier != $loadedContentTypeDraft->identifier) {
            try {
                $this->loadContentTypeByIdentifier($contentTypeUpdateStruct->identifier);
                throw new InvalidArgumentException('$contentTypeUpdateStruct', "Another ContentType with identifier '{$contentTypeUpdateStruct->identifier}' exists");
            } catch (APINotFoundException $e) {
                // Do nothing
            }
        }
        if ($contentTypeUpdateStruct->remoteId !== null && $contentTypeUpdateStruct->remoteId != $loadedContentTypeDraft->remoteId) {
            try {
                $this->loadContentTypeByRemoteId($contentTypeUpdateStruct->remoteId);
                throw new InvalidArgumentException('$contentTypeUpdateStruct', "Another ContentType with remoteId '{$contentTypeUpdateStruct->remoteId}' exists");
            } catch (APINotFoundException $e) {
                // Do nothing
            }
        }
        $this->repository->beginTransaction();
        try {
            $this->contentTypeHandler->update($contentTypeDraft->id, $contentTypeDraft->status, $this->contentTypeDomainMapper->buildSPIContentTypeUpdateStruct($loadedContentTypeDraft, $contentTypeUpdateStruct, $this->repository->getCurrentUserReference()));
            $this->repository->commit();
        } catch (Exception $e) {
            $this->repository->rollback();
            throw $e;
        }
    }