eZPublishCommunityProject  2013.5
eZ\Publish\Core\Repository\ObjectStateService Class Reference
+ Inheritance diagram for eZ\Publish\Core\Repository\ObjectStateService:
+ Collaboration diagram for eZ\Publish\Core\Repository\ObjectStateService:

Public Member Functions

 __construct (RepositoryInterface $repository, Handler $objectStateHandler, array $settings=array())
 Setups service with reference to repository object that created it & corresponding handler. More...
 
 createObjectState (APIObjectStateGroup $objectStateGroup, ObjectStateCreateStruct $objectStateCreateStruct)
 Creates a new object state in the given group. More...
 
 createObjectStateGroup (ObjectStateGroupCreateStruct $objectStateGroupCreateStruct)
 Creates a new object state group. More...
 
 deleteObjectState (APIObjectState $objectState)
 Deletes a object state. More...
 
 deleteObjectStateGroup (APIObjectStateGroup $objectStateGroup)
 Deletes a object state group including all states and links to content. More...
 
 getContentCount (APIObjectState $objectState)
 Returns the number of objects which are in this state. More...
 
 getContentState (ContentInfo $contentInfo, APIObjectStateGroup $objectStateGroup)
 Gets the object-state of object identified by $contentId. More...
 
 loadObjectState ($stateId)
 Loads an object state. More...
 
 loadObjectStateGroup ($objectStateGroupId)
 Loads a object state group. More...
 
 loadObjectStateGroups ($offset=0, $limit=-1)
 Loads all object state groups. More...
 
 loadObjectStates (APIObjectStateGroup $objectStateGroup)
 This method returns the ordered list of object states of a group. More...
 
 newObjectStateCreateStruct ($identifier)
 Instantiates a new Object State Create Struct and sets $identifier in it. More...
 
 newObjectStateGroupCreateStruct ($identifier)
 Instantiates a new Object State Group Create Struct and sets $identified in it. More...
 
 newObjectStateGroupUpdateStruct ()
 Instantiates a new Object State Group Update Struct. More...
 
 newObjectStateUpdateStruct ()
 Instantiates a new Object State Update Struct. More...
 
 setContentState (ContentInfo $contentInfo, APIObjectStateGroup $objectStateGroup, APIObjectState $objectState)
 Sets the object-state of a state group to $state for the given content. More...
 
 setPriorityOfObjectState (APIObjectState $objectState, $priority)
 Changes the priority of the state. More...
 
 updateObjectState (APIObjectState $objectState, ObjectStateUpdateStruct $objectStateUpdateStruct)
 Updates an object state. More...
 
 updateObjectStateGroup (APIObjectStateGroup $objectStateGroup, ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct)
 Updates an object state group. More...
 
- Public Member Functions inherited from eZ\Publish\API\Repository\ObjectStateService
 createObjectState (ObjectStateGroup $objectStateGroup, ObjectStateCreateStruct $objectStateCreateStruct)
 Creates a new object state in the given group. More...
 
 deleteObjectState (ObjectState $objectState)
 Deletes a object state. More...
 
 deleteObjectStateGroup (ObjectStateGroup $objectStateGroup)
 Deletes a object state group including all states and links to content. More...
 
 getContentCount (ObjectState $objectState)
 Returns the number of objects which are in this state. More...
 
 getContentState (ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup)
 Gets the object-state of object identified by $contentId. More...
 
 loadObjectStates (ObjectStateGroup $objectStateGroup)
 This method returns the ordered list of object states of a group. More...
 
 setContentState (ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup, ObjectState $objectState)
 Sets the object-state of a state group to $state for the given content. More...
 
 setPriorityOfObjectState (ObjectState $objectState, $priority)
 Changes the priority of the state. More...
 
 updateObjectState (ObjectState $objectState, ObjectStateUpdateStruct $objectStateUpdateStruct)
 Updates an object state. More...
 
 updateObjectStateGroup (ObjectStateGroup $objectStateGroup, ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct)
 Updates an object state group. More...
 

Protected Member Functions

 buildCreateInputStruct ($identifier, $defaultLanguageCode, $names, $descriptions)
 Validates input for creating object states/groups and builds the InputStruct object. More...
 
 buildDomainObjectStateGroupObject (SPIObjectStateGroup $spiObjectStateGroup)
 Converts the object state group SPI value object to API value object. More...
 
 buildDomainObjectStateObject (SPIObjectState $spiObjectState, APIObjectStateGroup $objectStateGroup=null)
 Converts the object state SPI value object to API value object. More...
 
 buildObjectStateGroupUpdateInputStruct (APIObjectStateGroup $objectStateGroup, $identifier, $defaultLanguageCode, $names, $descriptions)
 Validates input for updating object state groups and builds the InputStruct object. More...
 
 buildObjectStateUpdateInputStruct (APIObjectState $objectState, $identifier, $defaultLanguageCode, $names, $descriptions)
 Validates input for updating object states and builds the InputStruct object. More...
 

Protected Attributes

 $objectStateHandler
 
 $repository
 
 $settings
 

Constructor & Destructor Documentation

eZ\Publish\Core\Repository\ObjectStateService::__construct ( RepositoryInterface  $repository,
Handler  $objectStateHandler,
array  $settings = array() 
)

Setups service with reference to repository object that created it & corresponding handler.

Parameters
\eZ\Publish\API\Repository\Repository$repository
\eZ\Publish\SPI\Persistence\Content\ObjectState\Handler$objectStateHandler
array$settings

Member Function Documentation

eZ\Publish\Core\Repository\ObjectStateService::buildCreateInputStruct (   $identifier,
  $defaultLanguageCode,
  $names,
  $descriptions 
)
protected

Validates input for creating object states/groups and builds the InputStruct object.

Parameters
string$identifier
string$defaultLanguageCode
string[]$names
string[]$descriptions
Returns

Referenced by eZ\Publish\Core\Repository\ObjectStateService\createObjectState(), and eZ\Publish\Core\Repository\ObjectStateService\createObjectStateGroup().

eZ\Publish\Core\Repository\ObjectStateService::buildDomainObjectStateGroupObject ( SPIObjectStateGroup  $spiObjectStateGroup)
protected
eZ\Publish\Core\Repository\ObjectStateService::buildDomainObjectStateObject ( SPIObjectState  $spiObjectState,
APIObjectStateGroup  $objectStateGroup = null 
)
protected

Converts the object state SPI value object to API value object.

Parameters
\eZ\Publish\SPI\Persistence\Content\ObjectState$spiObjectState
\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup$objectStateGroup
Returns

Referenced by eZ\Publish\Core\Repository\ObjectStateService\createObjectState(), eZ\Publish\Core\Repository\ObjectStateService\getContentState(), eZ\Publish\Core\Repository\ObjectStateService\loadObjectState(), eZ\Publish\Core\Repository\ObjectStateService\loadObjectStates(), and eZ\Publish\Core\Repository\ObjectStateService\updateObjectState().

eZ\Publish\Core\Repository\ObjectStateService::buildObjectStateGroupUpdateInputStruct ( APIObjectStateGroup  $objectStateGroup,
  $identifier,
  $defaultLanguageCode,
  $names,
  $descriptions 
)
protected

Validates input for updating object state groups and builds the InputStruct object.

Parameters
\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup$objectStateGroup
string$identifier
string$defaultLanguageCode
string[]$names
string[]$descriptions
Returns

Referenced by eZ\Publish\Core\Repository\ObjectStateService\updateObjectStateGroup().

eZ\Publish\Core\Repository\ObjectStateService::buildObjectStateUpdateInputStruct ( APIObjectState  $objectState,
  $identifier,
  $defaultLanguageCode,
  $names,
  $descriptions 
)
protected

Validates input for updating object states and builds the InputStruct object.

Parameters
\eZ\Publish\API\Repository\Values\ObjectState\ObjectState$objectState
string$identifier
string$defaultLanguageCode
string[]$names
string[]$descriptions
Returns

Referenced by eZ\Publish\Core\Repository\ObjectStateService\updateObjectState().

eZ\Publish\Core\Repository\ObjectStateService::createObjectState ( APIObjectStateGroup  $objectStateGroup,
ObjectStateCreateStruct  $objectStateCreateStruct 
)

Creates a new object state in the given group.

Note: in current kernel: If it is the first state all content objects will set to this state.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to create an object state
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the object state with provided identifier already exists in the same group
Parameters
\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup$objectStateGroup
\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateCreateStruct$objectStateCreateStruct
Returns
eZ\Publish\Core\Repository\ObjectStateService::createObjectStateGroup ( ObjectStateGroupCreateStruct  $objectStateGroupCreateStruct)

Creates a new object state group.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to create an object state group
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the object state group with provided identifier already exists
Parameters
\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupCreateStruct$objectStateGroupCreateStruct
Returns

Implements eZ\Publish\API\Repository\ObjectStateService.

eZ\Publish\Core\Repository\ObjectStateService::deleteObjectState ( APIObjectState  $objectState)

Deletes a object state.

The state of the content objects is reset to the first object state in the group.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to delete an object state
Parameters
\eZ\Publish\API\Repository\Values\ObjectState\ObjectState$objectState
eZ\Publish\Core\Repository\ObjectStateService::deleteObjectStateGroup ( APIObjectStateGroup  $objectStateGroup)

Deletes a object state group including all states and links to content.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to delete an object state group
Parameters
\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup$objectStateGroup
eZ\Publish\Core\Repository\ObjectStateService::getContentCount ( APIObjectState  $objectState)

Returns the number of objects which are in this state.

Parameters
\eZ\Publish\API\Repository\Values\ObjectState\ObjectState$objectState
Returns
int
eZ\Publish\Core\Repository\ObjectStateService::getContentState ( ContentInfo  $contentInfo,
APIObjectStateGroup  $objectStateGroup 
)

Gets the object-state of object identified by $contentId.

The $state is the id of the state within one group.

Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo
\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup$objectStateGroup
Returns
eZ\Publish\Core\Repository\ObjectStateService::loadObjectState (   $stateId)
eZ\Publish\Core\Repository\ObjectStateService::loadObjectStateGroup (   $objectStateGroupId)

Loads a object state group.

Parameters
mixed$objectStateGroupId
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif the group was not found
Returns

Implements eZ\Publish\API\Repository\ObjectStateService.

Referenced by eZ\Publish\Core\Repository\ObjectStateService\buildDomainObjectStateObject(), eZ\Publish\Core\Repository\ObjectStateService\deleteObjectStateGroup(), and eZ\Publish\Core\Repository\ObjectStateService\updateObjectStateGroup().

eZ\Publish\Core\Repository\ObjectStateService::loadObjectStateGroups (   $offset = 0,
  $limit = -1 
)

Loads all object state groups.

Parameters
int$offset
int$limit
Returns
[]

Implements eZ\Publish\API\Repository\ObjectStateService.

eZ\Publish\Core\Repository\ObjectStateService::loadObjectStates ( APIObjectStateGroup  $objectStateGroup)

This method returns the ordered list of object states of a group.

Parameters
\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup$objectStateGroup
Returns
[]
eZ\Publish\Core\Repository\ObjectStateService::newObjectStateCreateStruct (   $identifier)

Instantiates a new Object State Create Struct and sets $identifier in it.

Parameters
string$identifier
Returns

Implements eZ\Publish\API\Repository\ObjectStateService.

eZ\Publish\Core\Repository\ObjectStateService::newObjectStateGroupCreateStruct (   $identifier)

Instantiates a new Object State Group Create Struct and sets $identified in it.

Parameters
string$identifier
Returns

Implements eZ\Publish\API\Repository\ObjectStateService.

eZ\Publish\Core\Repository\ObjectStateService::newObjectStateGroupUpdateStruct ( )

Instantiates a new Object State Group Update Struct.

Returns

Implements eZ\Publish\API\Repository\ObjectStateService.

eZ\Publish\Core\Repository\ObjectStateService::newObjectStateUpdateStruct ( )

Instantiates a new Object State Update Struct.

Returns

Implements eZ\Publish\API\Repository\ObjectStateService.

eZ\Publish\Core\Repository\ObjectStateService::setContentState ( ContentInfo  $contentInfo,
APIObjectStateGroup  $objectStateGroup,
APIObjectState  $objectState 
)

Sets the object-state of a state group to $state for the given content.

Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the object state does not belong to the given group
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to change the object state
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo
\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup$objectStateGroup
\eZ\Publish\API\Repository\Values\ObjectState\ObjectState$objectState
eZ\Publish\Core\Repository\ObjectStateService::setPriorityOfObjectState ( APIObjectState  $objectState,
  $priority 
)

Changes the priority of the state.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to change priority on an object state
Parameters
\eZ\Publish\API\Repository\Values\ObjectState\ObjectState$objectState
int$priority
eZ\Publish\Core\Repository\ObjectStateService::updateObjectState ( APIObjectState  $objectState,
ObjectStateUpdateStruct  $objectStateUpdateStruct 
)

Updates an object state.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to update an object state
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the object state with provided identifier already exists in the same group
Parameters
\eZ\Publish\API\Repository\Values\ObjectState\ObjectState$objectState
\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateUpdateStruct$objectStateUpdateStruct
Returns
eZ\Publish\Core\Repository\ObjectStateService::updateObjectStateGroup ( APIObjectStateGroup  $objectStateGroup,
ObjectStateGroupUpdateStruct  $objectStateGroupUpdateStruct 
)

Updates an object state group.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to update an object state group
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the object state group with provided identifier already exists
Parameters
\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup$objectStateGroup
\eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct$objectStateGroupUpdateStruct
Returns

Member Data Documentation

eZ\Publish\Core\Repository\ObjectStateService::$objectStateHandler
protected
eZ\Publish\Core\Repository\ObjectStateService::$repository
protected
eZ\Publish\Core\Repository\ObjectStateService::$settings
protected

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