Interface

eZ\Publish\SPI\Persistence\Content\Type\Handler

interface Handler

Methods

Group createGroup(CreateStruct $group)

updateGroup(UpdateStruct $group)

deleteGroup(mixed $groupId)

Group loadGroup(mixed $groupId)

Group[] loadGroups(array $groupIds)

Return list of unique Content Type Groups, with group id as key.

Group loadGroupByIdentifier(string $identifier)

Loads Type Group by identifier.

Group[] loadAllGroups()

Type[] loadContentTypes(mixed $groupId, int $status = Type::STATUS_DEFINED)

Type load(mixed $contentTypeId, int $status = Type::STATUS_DEFINED)

Loads a content type by id and status.

Type loadByIdentifier(string $identifier)

Loads a (defined) content type by identifier.

Type loadByRemoteId(mixed $remoteId)

Loads a (defined) content type by remote id.

Type create(CreateStruct $contentType)

update(mixed $contentTypeId, int $status, UpdateStruct $contentType)

delete(mixed $contentTypeId, int $status)

Type createDraft(mixed $modifierId, mixed $contentTypeId)

Creates a draft of existing defined content type.

Type copy(mixed $userId, mixed $contentTypeId, int $status)

Copy a Type incl fields and group-relations from a given status to a new Type with status {@link Type::STATUS_DRAFT}.

unlink(mixed $groupId, mixed $contentTypeId, int $status)

Unlink a content type group from a content type.

link(mixed $groupId, mixed $contentTypeId, int $status)

Link a content type group with a content type.

FieldDefinition getFieldDefinition(mixed $id, int $status)

Returns field definition for the given field definition id.

int getContentCount(mixed $contentTypeId)

Counts the number of Content instances of the ContentType identified by given $contentTypeId.

FieldDefinition addFieldDefinition(mixed $contentTypeId, int $status, FieldDefinition $fieldDefinition)

Adds a new field definition to an existing Type.

removeFieldDefinition(mixed $contentTypeId, int $status, mixed $fieldDefinitionId)

Removes a field definition from an existing Type.

updateFieldDefinition(mixed $contentTypeId, int $status, FieldDefinition $fieldDefinition)

This method updates the given $fieldDefinition on a Type.

publish(mixed $contentTypeId)

Update content objects.

array getSearchableFieldMap()

Returns content type, field definition and field type mapping information for search engine usage.

Details

at line 22
public Group createGroup(CreateStruct $group)

Parameters

CreateStruct $group

Return Value

Group

at line 27
public updateGroup(UpdateStruct $group)

Parameters

UpdateStruct $group

at line 35
public deleteGroup(mixed $groupId)

Parameters

mixed $groupId

Exceptions

BadStateException If type group contains types
NotFoundException If type group with id is not found

at line 44
public Group loadGroup(mixed $groupId)

Parameters

mixed $groupId

Return Value

Group

Exceptions

NotFoundException If type group with id is not found

at line 56
public Group[] loadGroups(array $groupIds)

Return list of unique Content Type Groups, with group id as key.

Missing items (NotFound) will be missing from the array and not cause an exception, it's up to calling logic to determine if this should cause exception or not.

Parameters

array $groupIds

Return Value

Group[]

at line 69
public Group loadGroupByIdentifier(string $identifier)

Loads Type Group by identifier.

Legacy note: Uses name for identifier.

Parameters

string $identifier

Return Value

Group

Exceptions

NotFoundException If type group with id is not found

at line 74
public Group[] loadAllGroups()

Return Value

Group[]

at line 82
public Type[] loadContentTypes(mixed $groupId, int $status = Type::STATUS_DEFINED)

Parameters

mixed $groupId
int $status One of Type::STATUSDEFINED|Type::STATUSDRAFT|Type::STATUS_MODIFIED

Return Value

Type[]

at line 96
public Type load(mixed $contentTypeId, int $status = Type::STATUS_DEFINED)

Loads a content type by id and status.

Note: This method is responsible of having the Field Definitions of the loaded ContentType sorted by placement.

Parameters

mixed $contentTypeId
int $status One of Type::STATUSDEFINED|Type::STATUSDRAFT|Type::STATUS_MODIFIED

Return Value

Type

Exceptions

NotFoundException If type with provided status is not found

at line 109
public Type loadByIdentifier(string $identifier)

Loads a (defined) content type by identifier.

Note: This method is responsible of having the Field Definitions of the loaded ContentType sorted by placement.

Parameters

string $identifier

Return Value

Type

Exceptions

NotFoundException If defined type is not found

at line 122
public Type loadByRemoteId(mixed $remoteId)

Loads a (defined) content type by remote id.

Note: This method is responsible of having the Field Definitions of the loaded ContentType sorted by placement.

Parameters

mixed $remoteId

Return Value

Type

Exceptions

NotFoundException If defined type is not found

at line 129
public Type create(CreateStruct $contentType)

Parameters

CreateStruct $contentType

Return Value

Type

at line 136
public update(mixed $contentTypeId, int $status, UpdateStruct $contentType)

Parameters

mixed $contentTypeId
int $status One of Type::STATUSDEFINED|Type::STATUSDRAFT|Type::STATUS_MODIFIED
UpdateStruct $contentType

at line 144
public delete(mixed $contentTypeId, int $status)

Parameters

mixed $contentTypeId
int $status One of Type::STATUSDEFINED|Type::STATUSDRAFT|Type::STATUS_MODIFIED

Exceptions

BadStateException If type is defined and still has content

at line 158
public Type createDraft(mixed $modifierId, mixed $contentTypeId)

Creates a draft of existing defined content type.

Updates modified date, sets $modifierId and status to Type::STATUS_DRAFT on the new returned draft.

Parameters

mixed $modifierId
mixed $contentTypeId

Return Value

Type

Exceptions

NotFoundException If type with defined status is not found

at line 174
public Type copy(mixed $userId, mixed $contentTypeId, int $status)

Copy a Type incl fields and group-relations from a given status to a new Type with status {@link Type::STATUS_DRAFT}.

New Content Type will have $userId as creator / modifier, created / modified should be updated, new remoteId created and identifier should be 'copyof_' or another unique string.

Parameters

mixed $userId
mixed $contentTypeId
int $status One of Type::STATUSDEFINED|Type::STATUSDRAFT|Type::STATUS_MODIFIED

Return Value

Type

Exceptions

NotFoundException If user or type with provided status is not found

Unlink a content type group from a content type.

Parameters

mixed $groupId
mixed $contentTypeId
int $status One of Type::STATUSDEFINED|Type::STATUSDRAFT|Type::STATUS_MODIFIED

Exceptions

NotFoundException If group or type with provided status is not found
BadStateException If $groupId is last group on $contentTypeId or not a group assigned to type

Link a content type group with a content type.

Parameters

mixed $groupId
mixed $contentTypeId
int $status One of Type::STATUSDEFINED|Type::STATUSDRAFT|Type::STATUS_MODIFIED

Exceptions

NotFoundException If group or type with provided status is not found
BadStateException If type is already part of group

at line 211
public FieldDefinition getFieldDefinition(mixed $id, int $status)

Returns field definition for the given field definition id.

Parameters

mixed $id
int $status One of Type::STATUSDEFINED|Type::STATUSDRAFT|Type::STATUS_MODIFIED

Return Value

FieldDefinition

Exceptions

NotFoundException If field definition is not found

at line 220
public int getContentCount(mixed $contentTypeId)

Counts the number of Content instances of the ContentType identified by given $contentTypeId.

Parameters

mixed $contentTypeId

Return Value

int

at line 239
public FieldDefinition addFieldDefinition(mixed $contentTypeId, int $status, FieldDefinition $fieldDefinition)

Adds a new field definition to an existing Type.

This method creates a new version of the Type with the $fieldDefinition added. It does not update existing content objects depending on the field (default) values.

Parameters

mixed $contentTypeId
int $status One of Type::STATUSDEFINED|Type::STATUSDRAFT|Type::STATUS_MODIFIED
FieldDefinition $fieldDefinition

Return Value

FieldDefinition

Exceptions

NotFoundException If type is not found

at line 254
public removeFieldDefinition(mixed $contentTypeId, int $status, mixed $fieldDefinitionId)

Removes a field definition from an existing Type.

This method creates a new version of the Type with the field definition referred to by $fieldDefinitionId removed. It does not update existing content objects depending on the field (default) values.

Parameters

mixed $contentTypeId
int $status One of Type::STATUSDEFINED|Type::STATUSDRAFT|Type::STATUS_MODIFIED
mixed $fieldDefinitionId

Exceptions

NotFoundException If field is not found

at line 272
public updateFieldDefinition(mixed $contentTypeId, int $status, FieldDefinition $fieldDefinition)

This method updates the given $fieldDefinition on a Type.

This method creates a new version of the Type with the updated $fieldDefinition. It does not update existing content objects depending on the field (default) values.

Parameters

mixed $contentTypeId
int $status One of Type::STATUSDEFINED|Type::STATUSDRAFT|Type::STATUS_MODIFIED
FieldDefinition $fieldDefinition

Exceptions

NotFoundException If field is not found

at line 288
public publish(mixed $contentTypeId)

Update content objects.

Updates content objects, depending on the changed field definitions.

A content type has a state which tells if its content objects yet have been adapted.

Flags the content type as updated.

Parameters

mixed $contentTypeId

Exceptions

NotFoundException If type with $contentTypeId and Type::STATUS_DRAFT is not found

at line 312
public array getSearchableFieldMap()

Returns content type, field definition and field type mapping information for search engine usage.

Only searchable field definitions will be included in the returned data.

Returns an array in the form:

array( "" => array( "" => array( "fielddefinitionid" => "", "fieldtypeidentifier" => "", ), ... ), ... )

Return Value

array