eZ\Publish\Core\Repository\ContentTypeService::deleteContentType PHP Метод

deleteContentType() публичный Метод

Deletes a content type if it has no instances. If content type in state STATUS_DRAFT is given, only the draft content type will be deleted. Otherwise, if content type in state STATUS_DEFINED is given, all content type data will be deleted.
public deleteContentType ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType )
$contentType eZ\Publish\API\Repository\Values\ContentType\ContentType
    public function deleteContentType(APIContentType $contentType)
    {
        if ($this->repository->hasAccess('class', 'delete') !== true) {
            throw new UnauthorizedException('ContentType', 'delete');
        }
        $this->repository->beginTransaction();
        try {
            if (!$contentType instanceof APIContentTypeDraft) {
                $this->contentTypeHandler->delete($contentType->id, APIContentTypeDraft::STATUS_DEFINED);
            }
            $this->contentTypeHandler->delete($contentType->id, APIContentTypeDraft::STATUS_DRAFT);
            $this->repository->commit();
        } catch (Exception $e) {
            $this->repository->rollback();
            throw $e;
        }
    }