eZPublishCommunityProject  2012.12
eZ\Publish\Core\REST\Client\ContentTypeService Class Reference
+ Inheritance diagram for eZ\Publish\Core\REST\Client\ContentTypeService:
+ Collaboration diagram for eZ\Publish\Core\REST\Client\ContentTypeService:

Public Member Functions

 __construct (HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, UrlHandler $urlHandler)
 
 addFieldDefinition (ContentTypeDraft $contentTypeDraft, FieldDefinitionCreateStruct $fieldDefinitionCreateStruct)
 Adds a new field definition to an existing content type. More...
 
 assignContentTypeGroup (ContentType $contentType, ContentTypeGroup $contentTypeGroup)
 Assigns a content type to a content type group. More...
 
 copyContentType (ContentType $contentType, User $user=null)
 Copy Type incl fields and groupIds to a new Type object. More...
 
 createContentType (ContentTypeCreateStruct $contentTypeCreateStruct, array $contentTypeGroups)
 Create a Content Type object. More...
 
 createContentTypeDraft (ContentType $contentType)
 Creates a draft from an existing content type. More...
 
 createContentTypeGroup (ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct)
 Create a Content Type Group object. More...
 
 deleteContentType (ContentType $contentType)
 Delete a Content Type object. More...
 
 deleteContentTypeGroup (ContentTypeGroup $contentTypeGroup)
 Delete a Content Type Group. More...
 
 loadContentType ($contentTypeId)
 Get a Content Type object by id. More...
 
 loadContentTypeByIdentifier ($identifier)
 Get a Content Type object by identifier. More...
 
 loadContentTypeByRemoteId ($remoteId)
 Get a Content Type object by id. More...
 
 loadContentTypeDraft ($contentTypeId)
 Get a Content Type object draft by id. More...
 
 loadContentTypeGroup ($contentTypeGroupId)
 Get a Content Type Group object by id. More...
 
 loadContentTypeGroupByIdentifier ($contentTypeGroupIdentifier)
 Get a Content Type Group object by identifier. More...
 
 loadContentTypeGroups ()
 Get all Content Type Groups. More...
 
 loadContentTypes (ContentTypeGroup $contentTypeGroup)
 Get Content Type objects which belong to the given content type group. More...
 
 loadFieldDefinition ($fieldDefinitionId)
 Loads a single field definition by $fieldDefinitionId. More...
 
 loadFieldDefinitionList ($fieldDefinitionListReference)
 Loads the FieldDefinitionList stored at $fieldDefinitionListReference. More...
 
 newContentTypeCreateStruct ($identifier)
 Instantiates a new content type create class. More...
 
 newContentTypeGroupCreateStruct ($identifier)
 Instantiates a new content type group create class. More...
 
 newContentTypeGroupUpdateStruct ()
 Instantiates a new content type update struct. More...
 
 newContentTypeUpdateStruct ()
 Instantiates a new content type update struct. More...
 
 newFieldDefinitionCreateStruct ($identifier, $fieldTypeIdentifier)
 Instantiates a field definition create struct. More...
 
 newFieldDefinitionUpdateStruct ()
 Instantiates a field definition update class. More...
 
 publishContentTypeDraft (ContentTypeDraft $contentTypeDraft)
 Publish the content type and update content objects. More...
 
 removeFieldDefinition (ContentTypeDraft $contentTypeDraft, FieldDefinition $fieldDefinition)
 Remove a field definition from an existing Type. More...
 
 setSession ($id)
 Set session ID. More...
 
 unassignContentTypeGroup (ContentType $contentType, ContentTypeGroup $contentTypeGroup)
 Unassign a content type from a group. More...
 
 updateContentTypeDraft (ContentTypeDraft $contentTypeDraft, ContentTypeUpdateStruct $contentTypeUpdateStruct)
 Update a Content Type object. More...
 
 updateContentTypeGroup (ContentTypeGroup $contentTypeGroup, ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct)
 Update a Content Type Group object. More...
 
 updateFieldDefinition (ContentTypeDraft $contentTypeDraft, FieldDefinition $fieldDefinition, FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct)
 Update a field definition. More...
 

Private Attributes

 $client
 
 $contentService
 
 $inputDispatcher
 
 $outputVisitor
 
 $urlHandler
 

Constructor & Destructor Documentation

eZ\Publish\Core\REST\Client\ContentTypeService::__construct ( HttpClient  $client,
Dispatcher  $inputDispatcher,
Visitor  $outputVisitor,
UrlHandler  $urlHandler 
)
Parameters
\eZ\Publish\Core\REST\Client\HttpClient$client
\eZ\Publish\Core\REST\Common\Input\Dispatcher$inputDispatcher
\eZ\Publish\Core\REST\Common\Output\Visitor$outputVisitor
\eZ\Publish\Core\REST\Common\UrlHandler$urlHandler

Member Function Documentation

eZ\Publish\Core\REST\Client\ContentTypeService::addFieldDefinition ( ContentTypeDraft  $contentTypeDraft,
FieldDefinitionCreateStruct  $fieldDefinitionCreateStruct 
)

Adds a new field definition to an existing content type.

The content type must be in state DRAFT.

Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the identifier in already exists in the content type
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to edit a content type
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft$contentTypeDraft
\eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct$fieldDefinitionCreateStruct

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::assignContentTypeGroup ( ContentType  $contentType,
ContentTypeGroup  $contentTypeGroup 
)

Assigns a content type to a content type group.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to unlink a content type
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the content type is already assigned the given group
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentType$contentType
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup$contentTypeGroup

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::copyContentType ( ContentType  $contentType,
User  $user = null 
)

Copy Type incl fields and groupIds to a new Type object.

New Type will have $userId as creator / modifier, created / modified should be updated with current time, updated remoteId and identifier should be appended with '_' + unique string.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to copy a content type
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentType$contentType
\eZ\Publish\API\Repository\Values\User\User$userif null the current user is used
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::createContentType ( ContentTypeCreateStruct  $contentTypeCreateStruct,
array  $contentTypeGroups 
)

Create a Content Type object.

The content type is created in the state STATUS_DRAFT.

Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the identifier or remoteId in the content type create struct already exists or there is a dublicate field identifier
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeCreateStruct$contentTypeCreateStruct
array$contentTypeGroupsRequired array of ContentTypeGroup to link type with (must contain one)
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::createContentTypeDraft ( ContentType  $contentType)

Creates a draft from an existing content type.

This is a complete copy of the content type wiich has the state STATUS_DRAFT.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to edit a content type
\eZ\Publish\API\Repository\Exceptions\BadStateExceptionIf there is already a draft assigned to another user
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentType$contentType
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::createContentTypeGroup ( ContentTypeGroupCreateStruct  $contentTypeGroupCreateStruct)

Create a Content Type Group object.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to create a content type group
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf a group with the same identifier already exists
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct$contentTypeGroupCreateStruct
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::deleteContentType ( ContentType  $contentType)

Delete a Content Type object.

Deletes a content type if it has no instances

Exceptions
\eZ\Publish\API\Repository\Exceptions\BadStateExceptionIf there exist content objects of this type
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to delete a content type
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentType$contentType

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::deleteContentTypeGroup ( ContentTypeGroup  $contentTypeGroup)

Delete a Content Type Group.

This method only deletes an content type group which has content types without any content instances

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to delete a content type group
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf a to be deleted content type has instances
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::loadContentType (   $contentTypeId)

Get a Content Type object by id.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf a content type with the given id and status DEFINED can not be found
Parameters
int$contentTypeId
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::loadContentTypeByIdentifier (   $identifier)

Get a Content Type object by identifier.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf content type with the given identifier and status DEFINED can not be found
Parameters
string$identifier
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::loadContentTypeByRemoteId (   $remoteId)

Get a Content Type object by id.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf content type with the given remote id and status DEFINED can not be found
Parameters
string$remoteId
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::loadContentTypeDraft (   $contentTypeId)

Get a Content Type object draft by id.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf the content type draft owned by the current user can not be found
Parameters
int$contentTypeId
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::loadContentTypeGroup (   $contentTypeGroupId)

Get a Content Type Group object by id.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf group can not be found
Parameters
int$contentTypeGroupId
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::loadContentTypeGroupByIdentifier (   $contentTypeGroupIdentifier)

Get a Content Type Group object by identifier.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf group can not be found
Parameters
string$contentTypeGroupIdentifier
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::loadContentTypeGroups ( )

Get all Content Type Groups.

Returns
[]

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::loadContentTypes ( ContentTypeGroup  $contentTypeGroup)

Get Content Type objects which belong to the given content type group.

Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup$contentTypeGroup
Returns
[] Which have status DEFINED

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::loadFieldDefinition (   $fieldDefinitionId)

Loads a single field definition by $fieldDefinitionId.

ATTENTION: This is not an API method and only meant for internal use in the REST Client implementation.

Parameters
string$fieldDefinitionIdprotected
Returns
FieldDefinition
eZ\Publish\Core\REST\Client\ContentTypeService::loadFieldDefinitionList (   $fieldDefinitionListReference)

Loads the FieldDefinitionList stored at $fieldDefinitionListReference.

ATTENTION: This is not an API method and only meant for internal use in the REST Client implementation.

Parameters
mixed$fieldDefinitionListReference
Returns
FieldDefinitionList
eZ\Publish\Core\REST\Client\ContentTypeService::newContentTypeCreateStruct (   $identifier)

Instantiates a new content type create class.

Parameters
string$identifier
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::newContentTypeGroupCreateStruct (   $identifier)

Instantiates a new content type group create class.

Parameters
string$identifier
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::newContentTypeGroupUpdateStruct ( )

Instantiates a new content type update struct.

Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::newContentTypeUpdateStruct ( )

Instantiates a new content type update struct.

Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::newFieldDefinitionCreateStruct (   $identifier,
  $fieldTypeIdentifier 
)

Instantiates a field definition create struct.

Parameters
string$fieldTypeIdentifierthe required field type identifier
string$identifierthe required identifier for the field definition
Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::newFieldDefinitionUpdateStruct ( )

Instantiates a field definition update class.

Returns

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::publishContentTypeDraft ( ContentTypeDraft  $contentTypeDraft)

Publish the content type and update content objects.

Exceptions
\eZ\Publish\API\Repository\Exceptions\BadStateExceptionIf the content type has no draft
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to publish a content type

This method updates content objects, depending on the changed field definitions.

Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft$contentTypeDraft

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::removeFieldDefinition ( ContentTypeDraft  $contentTypeDraft,
FieldDefinition  $fieldDefinition 
)

Remove a field definition from an existing Type.

Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the given field definition does not belong to the given type
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to edit a content type
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft$contentTypeDraft
\eZ\Publish\API\Repository\Values\ContentType\FieldDefinition$fieldDefinition

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::setSession (   $id)

Set session ID.

Only for testing

Parameters
mixedtringid
Returns
void

Implements eZ\Publish\Core\REST\Client\Sessionable.

eZ\Publish\Core\REST\Client\ContentTypeService::unassignContentTypeGroup ( ContentType  $contentType,
ContentTypeGroup  $contentTypeGroup 
)

Unassign a content type from a group.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to link a content type
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the content type is not assigned this the given group.
\eZ\Publish\API\Repository\Exceptions\BadStateExceptionIf $contentTypeGroup is the last group assigned to the content type
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentType$contentType
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup$contentTypeGroup

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::updateContentTypeDraft ( ContentTypeDraft  $contentTypeDraft,
ContentTypeUpdateStruct  $contentTypeUpdateStruct 
)

Update a Content Type object.

Does not update fields (fieldDefinitions), use updateFieldDefinition() to update them.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to update a content type
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the given identifier or remoteId already exists or there is no draft assigned to the authenticated user
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft$contentTypeDraft
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeUpdateStruct$contentTypeUpdateStruct

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::updateContentTypeGroup ( ContentTypeGroup  $contentTypeGroup,
ContentTypeGroupUpdateStruct  $contentTypeGroupUpdateStruct 
)

Update a Content Type Group object.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to create a content type group
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the given identifier (if set) already exists
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup$contentTypeGroupthe content type group to be updated
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupUpdateStruct$contentTypeGroupUpdateStruct

Implements eZ\Publish\API\Repository\ContentTypeService.

eZ\Publish\Core\REST\Client\ContentTypeService::updateFieldDefinition ( ContentTypeDraft  $contentTypeDraft,
FieldDefinition  $fieldDefinition,
FieldDefinitionUpdateStruct  $fieldDefinitionUpdateStruct 
)

Update a field definition.

Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the field id in the update struct is not found or does not belong to the content type
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to edit a content type
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the given identifier is used in an existing field of the given content type
Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft$contentTypeDraftthe content type draft
\eZ\Publish\API\Repository\Values\ContentType\FieldDefinition$fieldDefinitionthe field definition which should be updated
\eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionUpdateStruct$fieldDefinitionUpdateStruct

Implements eZ\Publish\API\Repository\ContentTypeService.

Member Data Documentation

eZ\Publish\Core\REST\Client\ContentTypeService::$client
private
eZ\Publish\Core\REST\Client\ContentTypeService::$contentService
private
eZ\Publish\Core\REST\Client\ContentTypeService::$inputDispatcher
private
eZ\Publish\Core\REST\Client\ContentTypeService::$outputVisitor
private
eZ\Publish\Core\REST\Client\ContentTypeService::$urlHandler
private

The documentation for this class was generated from the following file: