PHP Class eZ\Publish\Core\Repository\ContentTypeService

Inheritance: implements eZ\Publish\API\Repository\ContentTypeService
Mostrar archivo Open project: ezsystems/ezpublish-kernel Class Usage Examples

Protected Properties

Property Type Description
$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

Public Methods

Method Description
__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.

Protected Methods

Method Description
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.

Method Details

__construct() public method

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() public method

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() public method

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() public method

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
return eZ\Publish\API\Repository\Values\ContentType\ContentType

createContentType() public method

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)
return eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft

createContentTypeDraft() public method

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
return eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft

createContentTypeGroup() public method

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
return eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup

deleteContentType() public method

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() public method

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() public method

Returns true if the given content type $contentType has content instances.
Since: 6.0.1
public isContentTypeUsed ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType ) : boolean
$contentType eZ\Publish\API\Repository\Values\ContentType\ContentType
return boolean

loadContentType() public method

Get a Content Type object by id.
public loadContentType ( mixed $contentTypeId ) : eZ\Publish\API\Repository\Values\ContentType\ContentType
$contentTypeId mixed
return eZ\Publish\API\Repository\Values\ContentType\ContentType

loadContentTypeByIdentifier() public method

Get a Content Type object by identifier.
public loadContentTypeByIdentifier ( string $identifier ) : eZ\Publish\API\Repository\Values\ContentType\ContentType
$identifier string
return eZ\Publish\API\Repository\Values\ContentType\ContentType

loadContentTypeByRemoteId() public method

Get a Content Type object by id.
public loadContentTypeByRemoteId ( string $remoteId ) : eZ\Publish\API\Repository\Values\ContentType\ContentType
$remoteId string
return eZ\Publish\API\Repository\Values\ContentType\ContentType

loadContentTypeDraft() public method

Get a Content Type object draft by id.
public loadContentTypeDraft ( mixed $contentTypeId ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft
$contentTypeId mixed
return eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft

loadContentTypeGroup() public method

Get a Content Type Group object by id.
public loadContentTypeGroup ( mixed $contentTypeGroupId ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup
$contentTypeGroupId mixed
return eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup

loadContentTypeGroupByIdentifier() public method

Get a Content Type Group object by identifier.
public loadContentTypeGroupByIdentifier ( string $contentTypeGroupIdentifier ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup
$contentTypeGroupIdentifier string
return eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup

loadContentTypeGroups() public method

Get all Content Type Groups.
public loadContentTypeGroups ( ) : ContentTypeGroup[]
return eZ\Publish\Core\Repository\Values\ContentType\ContentTypeGroup[]

loadContentTypes() public method

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
return eZ\Publish\API\Repository\Values\ContentType\ContentType[] Which have status DEFINED

newContentTypeCreateStruct() public method

Instantiates a new content type create class.
public newContentTypeCreateStruct ( string $identifier ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct
$identifier string
return eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct

newContentTypeGroupCreateStruct() public method

Instantiates a new content type group create class.
public newContentTypeGroupCreateStruct ( string $identifier ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct
$identifier string
return eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct

newContentTypeGroupUpdateStruct() public method

Instantiates a new content type update struct.
public newContentTypeGroupUpdateStruct ( ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupUpdateStruct
return eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupUpdateStruct

newContentTypeUpdateStruct() public method

Instantiates a new content type update struct.
public newContentTypeUpdateStruct ( ) : eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct
return eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct

newFieldDefinitionCreateStruct() public method

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
return eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct

newFieldDefinitionUpdateStruct() public method

Instantiates a field definition update class.
public newFieldDefinitionUpdateStruct ( ) : eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct
return eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct

publishContentTypeDraft() public method

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() public method

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() public method

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() 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

updateContentTypeGroup() public method

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() public method

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() protected method

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
return eZ\Publish\SPI\FieldType\ValidationError[]

validateInputContentTypeCreateStruct() protected method

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

validateInputContentTypeGroups() protected method

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

validateInputFieldDefinitionCreateStruct() protected method

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

Property Details

$contentTypeDomainMapper protected_oe property

protected ContentTypeDomainMapper,eZ\Publish\Core\Repository\Helper $contentTypeDomainMapper
return eZ\Publish\Core\Repository\Helper\ContentTypeDomainMapper

$contentTypeHandler protected_oe property

protected Handler,eZ\Publish\SPI\Persistence\Content\Type $contentTypeHandler
return eZ\Publish\SPI\Persistence\Content\Type\Handler

$domainMapper protected_oe property

protected DomainMapper,eZ\Publish\Core\Repository\Helper $domainMapper
return eZ\Publish\Core\Repository\Helper\DomainMapper

$fieldTypeRegistry protected_oe property

protected FieldTypeRegistry,eZ\Publish\Core\Repository\Helper $fieldTypeRegistry
return eZ\Publish\Core\Repository\Helper\FieldTypeRegistry

$repository protected_oe property

protected Repository,eZ\Publish\API\Repository $repository
return eZ\Publish\API\Repository\Repository

$settings protected_oe property

protected array $settings
return array