eZPublishCommunityProject  2013.6
eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler Class Reference

The Object State Handler class provides managing of object states and groups. More...

+ Inheritance diagram for eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler:
+ Collaboration diagram for eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler:

Public Member Functions

 __construct (Handler $handler, Backend $backend)
 Setups current handler instance with reference to Handler object that created it. More...
 
 create ($groupId, InputStruct $input)
 Creates a new object state in the given group. More...
 
 createGroup (InputStruct $input)
 Creates a new object state group. More...
 
 delete ($stateId)
 Deletes a object state. More...
 
 deleteGroup ($groupId)
 Deletes a object state group including all states and links to content. More...
 
 getContentCount ($stateId)
 Returns the number of objects which are in this state. More...
 
 getContentState ($contentId, $stateGroupId)
 Gets the object-state of object identified by $contentId. More...
 
 load ($stateId)
 Loads an object state. More...
 
 loadAllGroups ($offset=0, $limit=-1)
 Loads all object state groups. More...
 
 loadByIdentifier ($identifier, $groupId)
 Loads an object state by identifier and group it belongs to. More...
 
 loadGroup ($groupId)
 Loads a object state group. More...
 
 loadGroupByIdentifier ($identifier)
 Loads a object state group by identifier. More...
 
 loadObjectStates ($groupId)
 This method returns the ordered list of object states of a group. More...
 
 setContentState ($contentId, $groupId, $stateId)
 Sets the object-state of a state group to $stateId for the given content. More...
 
 setPriority ($stateId, $priority)
 Changes the priority of the state. More...
 
 update ($stateId, InputStruct $input)
 Updates an object state. More...
 
 updateGroup ($groupId, InputStruct $input)
 Updates an object state group. More...
 

Protected Member Functions

 getContentToStateMap ()
 Gets a mapping array of all content and states they belong to. More...
 
 getGroupStateList ($groupId)
 Returns all state IDs that belong to $groupId. More...
 
 getInputData (InputStruct $input)
 Converts InputStruct to array and adds missing languageCodes array into it. More...
 
 getObjectStateContentList ($stateId)
 Returns all content IDs that belong to $stateId. More...
 

Protected Attributes

 $backend
 
 $handler
 

Detailed Description

The Object State Handler class provides managing of object states and groups.

Constructor & Destructor Documentation

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::__construct ( Handler  $handler,
Backend  $backend 
)

Setups current handler instance with reference to Handler object that created it.

Parameters
Handler$handler
Backend$backendThe storage engine backend

Member Function Documentation

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::create (   $groupId,
InputStruct  $input 
)

Creates a new object state in the given group.

The new state gets the last priority. Note: in current kernel: If it is the first state all content objects will set to this state.

Parameters
mixed$groupId
\eZ\Publish\SPI\Persistence\Content\ObjectState\InputStruct$input
Returns

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::createGroup ( InputStruct  $input)

Creates a new object state group.

Parameters
\eZ\Publish\SPI\Persistence\Content\ObjectState\InputStruct$input
Returns

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::delete (   $stateId)

Deletes a object state.

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

Parameters
mixed$stateId

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::deleteGroup (   $groupId)

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

Parameters
mixed$groupId

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::getContentCount (   $stateId)

Returns the number of objects which are in this state.

Parameters
mixed$stateId
Returns
int

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::getContentState (   $contentId,
  $stateGroupId 
)

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

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

Parameters
mixed$contentId
mixed$stateGroupId
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif no state is found
Returns

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::getContentToStateMap ( )
protected

Gets a mapping array of all content and states they belong to.

This method serves as a hack because InMemory storage is unable to store M:N relations between content and object states as there's no value object for the link

Returns
array

Referenced by eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler\getContentState(), eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler\getObjectStateContentList(), and eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler\setContentState().

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::getGroupStateList (   $groupId)
protected

Returns all state IDs that belong to $groupId.

Parameters
int$groupId
Returns
array

Referenced by eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler\getContentState(), and eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler\setContentState().

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::getInputData ( InputStruct  $input)
protected

Converts InputStruct to array and adds missing languageCodes array into it.

Parameters
\eZ\Publish\SPI\Persistence\Content\ObjectState\InputStruct$input
Returns
array

Referenced by eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler\create(), eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler\createGroup(), eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler\update(), and eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler\updateGroup().

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::getObjectStateContentList (   $stateId)
protected
eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::load (   $stateId)
eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::loadAllGroups (   $offset = 0,
  $limit = -1 
)

Loads all object state groups.

Parameters
int$offset
int$limit
Returns
[]

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::loadByIdentifier (   $identifier,
  $groupId 
)

Loads an object state by identifier and group it belongs to.

Parameters
string$identifier
mixed$groupId
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif the state was not found
Returns

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::loadGroup (   $groupId)

Loads a object state group.

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

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

Referenced by eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler\updateGroup().

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::loadGroupByIdentifier (   $identifier)

Loads a object state group by identifier.

Parameters
string$identifier
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif the group was not found
Returns

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::loadObjectStates (   $groupId)
eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::setContentState (   $contentId,
  $groupId,
  $stateId 
)

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

Parameters
mixed$contentId
mixed$groupId
mixed$stateId
Returns
boolean

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::setPriority (   $stateId,
  $priority 
)

Changes the priority of the state.

Parameters
mixed$stateId
int$priority

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::update (   $stateId,
InputStruct  $input 
)

Updates an object state.

Parameters
mixed$stateId
\eZ\Publish\SPI\Persistence\Content\ObjectState\InputStruct$input
Returns

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::updateGroup (   $groupId,
InputStruct  $input 
)

Updates an object state group.

Parameters
mixed$groupId
\eZ\Publish\SPI\Persistence\Content\ObjectState\InputStruct$input
Returns

Implements eZ\Publish\SPI\Persistence\Content\ObjectState\Handler.

Member Data Documentation

eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::$backend
protected
eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::$handler
protected

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