PHP Класс eZ\Publish\Core\Repository\ContentTypeService

Наследование: implements eZ\Publish\API\Repository\ContentTypeService
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$contentTypeDomainMapper eZ\Publish\Core\Repository\Helper\ContentTypeDomainMapper
$contentTypeHandler eZ\Publish\SPI\Persistence\Content\Type\Handler
$domainMapper eZ\Publish\Core\Repository\Helper\DomainMapper
$fieldTypeRegistry eZ\Publish\Core\Repository\Helper\FieldTypeRegistry
$repository eZ\Publish\API\Repository\Repository
$settings array

Открытые методы

Метод Описание
__construct ( eZ\Publish\API\Repository\Repository $repository, eZ\Publish\SPI\Persistence\Content\Type\Handler $contentTypeHandler, DomainMapper $domainMapper, ContentTypeDomainMapper $contentTypeDomainMapper, FieldTypeRegistry $fieldTypeRegistry, array $settings = [] ) Setups service with reference to repository object that created it & corresponding handler.
addFieldDefinition ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft, eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct $fieldDefinitionCreateStruct ) Adds a new field definition to an existing content type.
assignContentTypeGroup ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType, eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup ) Assigns a content type to a content type group.
copyContentType ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType, eZ\Publish\API\Repository\Values\User\User $creator = null ) : eZ\Publish\API\Repository\Values\ContentType\ContentType Copy Type incl fields and groupIds to a new Type object.
createContentType ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct $contentTypeCreateStruct, array $contentTypeGroups ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft Create a Content Type object.
createContentTypeDraft ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft Creates a draft from an existing content type.
createContentTypeGroup ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup Create a Content Type Group object.
deleteContentType ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType ) Delete a Content Type object.
deleteContentTypeGroup ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup ) Delete a Content Type Group.
isContentTypeUsed ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType ) : boolean Returns true if the given content type $contentType has content instances.
loadContentType ( mixed $contentTypeId ) : eZ\Publish\API\Repository\Values\ContentType\ContentType Get a Content Type object by id.
loadContentTypeByIdentifier ( string $identifier ) : eZ\Publish\API\Repository\Values\ContentType\ContentType Get a Content Type object by identifier.
loadContentTypeByRemoteId ( string $remoteId ) : eZ\Publish\API\Repository\Values\ContentType\ContentType Get a Content Type object by id.
loadContentTypeDraft ( mixed $contentTypeId ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft Get a Content Type object draft by id.
loadContentTypeGroup ( mixed $contentTypeGroupId ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup Get a Content Type Group object by id.
loadContentTypeGroupByIdentifier ( string $contentTypeGroupIdentifier ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup Get a Content Type Group object by identifier.
loadContentTypeGroups ( ) : ContentTypeGroup[] Get all Content Type Groups.
loadContentTypes ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup ) : eZ\Publish\API\Repository\Values\ContentType\ContentType[] Get Content Type objects which belong to the given content type group.
newContentTypeCreateStruct ( string $identifier ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct Instantiates a new content type create class.
newContentTypeGroupCreateStruct ( string $identifier ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct Instantiates a new content type group create class.
newContentTypeGroupUpdateStruct ( ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupUpdateStruct Instantiates a new content type update struct.
newContentTypeUpdateStruct ( ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct Instantiates a new content type update struct.
newFieldDefinitionCreateStruct ( string $identifier, string $fieldTypeIdentifier ) : eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct Instantiates a field definition create struct.
newFieldDefinitionUpdateStruct ( ) : eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct Instantiates a field definition update class.
publishContentTypeDraft ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft ) Publish the content type and update content objects.
removeFieldDefinition ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft, eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDefinition ) Remove a field definition from an existing Type.
unassignContentTypeGroup ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType, eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup ) Unassign a content type from a group.
updateContentTypeDraft ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft, eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct $contentTypeUpdateStruct ) Update a Content Type object.
updateContentTypeGroup ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup, eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct ) Update a Content Type Group object.
updateFieldDefinition ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft, eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDefinition, eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct ) Update a field definition.

Защищенные методы

Метод Описание
validateFieldDefinitionCreateStruct ( eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct $fieldDefinitionCreateStruct, eZ\Publish\SPI\FieldType\FieldType $fieldType ) : eZ\Publish\SPI\FieldType\ValidationError[] Validates FieldDefinitionCreateStruct.
validateInputContentTypeCreateStruct ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct $contentTypeCreateStruct ) Validates input ContentType create struct.
validateInputContentTypeGroups ( array $contentTypeGroups ) Validates input ContentTypeGroup array.
validateInputFieldDefinitionCreateStruct ( eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct $fieldDefinitionCreateStruct, string $argumentName = '$fieldDefinitionCreateStruct' ) Validates input FieldDefinitionCreateStruct.

Описание методов

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

Setups service with reference to repository object that created it & corresponding handler.
public __construct ( eZ\Publish\API\Repository\Repository $repository, eZ\Publish\SPI\Persistence\Content\Type\Handler $contentTypeHandler, DomainMapper $domainMapper, ContentTypeDomainMapper $contentTypeDomainMapper, FieldTypeRegistry $fieldTypeRegistry, array $settings = [] )
$repository eZ\Publish\API\Repository\Repository
$contentTypeHandler eZ\Publish\SPI\Persistence\Content\Type\Handler
$domainMapper eZ\Publish\Core\Repository\Helper\DomainMapper
$contentTypeDomainMapper eZ\Publish\Core\Repository\Helper\ContentTypeDomainMapper
$fieldTypeRegistry eZ\Publish\Core\Repository\Helper\FieldTypeRegistry
$settings array

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

The content type must be in state DRAFT.
public addFieldDefinition ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft, eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct $fieldDefinitionCreateStruct )
$contentTypeDraft eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft
$fieldDefinitionCreateStruct eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct

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

Assigns a content type to a content type group.
public assignContentTypeGroup ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType, eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup )
$contentType eZ\Publish\API\Repository\Values\ContentType\ContentType
$contentTypeGroup eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup

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

New Type will have $creator as creator / modifier, created / modified should be updated with current time, updated remoteId and identifier should be appended with '_' + unique string.
public copyContentType ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType, eZ\Publish\API\Repository\Values\User\User $creator = null ) : eZ\Publish\API\Repository\Values\ContentType\ContentType
$contentType eZ\Publish\API\Repository\Values\ContentType\ContentType
$creator eZ\Publish\API\Repository\Values\User\User if null the current-user is used
Результат eZ\Publish\API\Repository\Values\ContentType\ContentType

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

The content type is created in the state STATUS_DRAFT.
public createContentType ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct $contentTypeCreateStruct, array $contentTypeGroups ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft
$contentTypeCreateStruct eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct
$contentTypeGroups array Required array of {@link APIContentTypeGroup} to link type with (must contain one)
Результат eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft

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

This is a complete copy of the content type which has the state STATUS_DRAFT.
public createContentTypeDraft ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft
$contentType eZ\Publish\API\Repository\Values\ContentType\ContentType
Результат eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft

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

Create a Content Type Group object.
public createContentTypeGroup ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup
$contentTypeGroupCreateStruct eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct
Результат eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup

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

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

This method only deletes an content type group which has content types without any content instances
public deleteContentTypeGroup ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup )
$contentTypeGroup eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup

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

Returns true if the given content type $contentType has content instances.
С версии: 6.0.1
public isContentTypeUsed ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType ) : boolean
$contentType eZ\Publish\API\Repository\Values\ContentType\ContentType
Результат boolean

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

Get a Content Type object by id.
public loadContentType ( mixed $contentTypeId ) : eZ\Publish\API\Repository\Values\ContentType\ContentType
$contentTypeId mixed
Результат eZ\Publish\API\Repository\Values\ContentType\ContentType

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

Get a Content Type object by identifier.
public loadContentTypeByIdentifier ( string $identifier ) : eZ\Publish\API\Repository\Values\ContentType\ContentType
$identifier string
Результат eZ\Publish\API\Repository\Values\ContentType\ContentType

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

Get a Content Type object by id.
public loadContentTypeByRemoteId ( string $remoteId ) : eZ\Publish\API\Repository\Values\ContentType\ContentType
$remoteId string
Результат eZ\Publish\API\Repository\Values\ContentType\ContentType

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

Get a Content Type object draft by id.
public loadContentTypeDraft ( mixed $contentTypeId ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft
$contentTypeId mixed
Результат eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft

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

Get a Content Type Group object by id.
public loadContentTypeGroup ( mixed $contentTypeGroupId ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup
$contentTypeGroupId mixed
Результат eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup

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

Get a Content Type Group object by identifier.
public loadContentTypeGroupByIdentifier ( string $contentTypeGroupIdentifier ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup
$contentTypeGroupIdentifier string
Результат eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup

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

Get all Content Type Groups.
public loadContentTypeGroups ( ) : ContentTypeGroup[]
Результат eZ\Publish\Core\Repository\Values\ContentType\ContentTypeGroup[]

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

Get Content Type objects which belong to the given content type group.
public loadContentTypes ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup ) : eZ\Publish\API\Repository\Values\ContentType\ContentType[]
$contentTypeGroup eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup
Результат eZ\Publish\API\Repository\Values\ContentType\ContentType[] Which have status DEFINED

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

Instantiates a new content type create class.
public newContentTypeCreateStruct ( string $identifier ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct
$identifier string
Результат eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct

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

Instantiates a new content type group create class.
public newContentTypeGroupCreateStruct ( string $identifier ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct
$identifier string
Результат eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct

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

Instantiates a new content type update struct.
public newContentTypeGroupUpdateStruct ( ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupUpdateStruct
Результат eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupUpdateStruct

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

Instantiates a new content type update struct.
public newContentTypeUpdateStruct ( ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct
Результат eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct

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

Instantiates a field definition create struct.
public newFieldDefinitionCreateStruct ( string $identifier, string $fieldTypeIdentifier ) : eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct
$identifier string the required identifier for the field definition
$fieldTypeIdentifier string the required field type identifier
Результат eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct

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

Instantiates a field definition update class.
public newFieldDefinitionUpdateStruct ( ) : eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct
Результат eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct

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

This method updates content objects, depending on the changed field definitions.
public publishContentTypeDraft ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft )
$contentTypeDraft eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft

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

Remove a field definition from an existing Type.
public removeFieldDefinition ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft, eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDefinition )
$contentTypeDraft eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft
$fieldDefinition eZ\Publish\API\Repository\Values\ContentType\FieldDefinition

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

Unassign a content type from a group.
public unassignContentTypeGroup ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType, eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup )
$contentType eZ\Publish\API\Repository\Values\ContentType\ContentType
$contentTypeGroup eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup

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

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

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

Update a Content Type Group object.
public updateContentTypeGroup ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup, eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct )
$contentTypeGroup eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup the content type group to be updated
$contentTypeGroupUpdateStruct eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupUpdateStruct

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

Update a field definition.
public updateFieldDefinition ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft, eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDefinition, eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct )
$contentTypeDraft eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft the content type draft
$fieldDefinition eZ\Publish\API\Repository\Values\ContentType\FieldDefinition the field definition which should be updated
$fieldDefinitionUpdateStruct eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct

validateFieldDefinitionCreateStruct() защищенный Метод

Validates FieldDefinitionCreateStruct.
protected validateFieldDefinitionCreateStruct ( eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct $fieldDefinitionCreateStruct, eZ\Publish\SPI\FieldType\FieldType $fieldType ) : eZ\Publish\SPI\FieldType\ValidationError[]
$fieldDefinitionCreateStruct eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct
$fieldType eZ\Publish\SPI\FieldType\FieldType
Результат eZ\Publish\SPI\FieldType\ValidationError[]

validateInputContentTypeCreateStruct() защищенный Метод

Validates input ContentType create struct.
protected validateInputContentTypeCreateStruct ( eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct $contentTypeCreateStruct )
$contentTypeCreateStruct eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct

validateInputContentTypeGroups() защищенный Метод

Validates input ContentTypeGroup array.
protected validateInputContentTypeGroups ( array $contentTypeGroups )
$contentTypeGroups array

validateInputFieldDefinitionCreateStruct() защищенный Метод

Validates input FieldDefinitionCreateStruct.
protected validateInputFieldDefinitionCreateStruct ( eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct $fieldDefinitionCreateStruct, string $argumentName = '$fieldDefinitionCreateStruct' )
$fieldDefinitionCreateStruct eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct
$argumentName string

Описание свойств

$contentTypeDomainMapper защищенное свойство

protected ContentTypeDomainMapper,eZ\Publish\Core\Repository\Helper $contentTypeDomainMapper
Результат eZ\Publish\Core\Repository\Helper\ContentTypeDomainMapper

$contentTypeHandler защищенное свойство

protected Handler,eZ\Publish\SPI\Persistence\Content\Type $contentTypeHandler
Результат eZ\Publish\SPI\Persistence\Content\Type\Handler

$domainMapper защищенное свойство

protected DomainMapper,eZ\Publish\Core\Repository\Helper $domainMapper
Результат eZ\Publish\Core\Repository\Helper\DomainMapper

$fieldTypeRegistry защищенное свойство

protected FieldTypeRegistry,eZ\Publish\Core\Repository\Helper $fieldTypeRegistry
Результат eZ\Publish\Core\Repository\Helper\FieldTypeRegistry

$repository защищенное свойство

protected Repository,eZ\Publish\API\Repository $repository
Результат eZ\Publish\API\Repository\Repository

$settings защищенное свойство

protected array $settings
Результат array