Class

eZ\Publish\Core\SignalSlot\ObjectStateService

class ObjectStateService implements ObjectStateService

ObjectStateService class.

Methods

__construct(ObjectStateService $service, SignalDispatcher $signalDispatcher)

Constructor.

ObjectStateGroup createObjectStateGroup(ObjectStateGroupCreateStruct $objectStateGroupCreateStruct)

Creates a new object state group.

ObjectStateGroup loadObjectStateGroup(mixed $objectStateGroupId, array $prioritizedLanguages = array())

Loads a object state group.

ObjectStateGroup[] loadObjectStateGroups(int $offset, int $limit = -1, array $prioritizedLanguages = array())

Loads all object state groups.

ObjectState[] loadObjectStates(ObjectStateGroup $objectStateGroup, array $prioritizedLanguages = array())

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

ObjectStateGroup updateObjectStateGroup(ObjectStateGroup $objectStateGroup, ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct)

Updates an object state group.

deleteObjectStateGroup(ObjectStateGroup $objectStateGroup)

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

ObjectState createObjectState(ObjectStateGroup $objectStateGroup, ObjectStateCreateStruct $objectStateCreateStruct)

Creates a new object state in the given group.

ObjectState loadObjectState(mixed $stateId, array $prioritizedLanguages = array())

Loads an object state.

ObjectState updateObjectState(ObjectState $objectState, ObjectStateUpdateStruct $objectStateUpdateStruct)

Updates an object state.

setPriorityOfObjectState(ObjectState $objectState, int $priority)

Changes the priority of the state.

deleteObjectState(ObjectState $objectState)

Deletes a object state.

setContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup, ObjectState $objectState)

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

ObjectState getContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup)

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

int getContentCount(ObjectState $objectState)

Returns the number of objects which are in this state.

ObjectStateGroupCreateStruct newObjectStateGroupCreateStruct(string $identifier)

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

ObjectStateGroupUpdateStruct newObjectStateGroupUpdateStruct()

Instantiates a new Object State Group Update Struct.

ObjectStateCreateStruct newObjectStateCreateStruct(string $identifier)

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

ObjectStateUpdateStruct newObjectStateUpdateStruct()

Instantiates a new Object State Update Struct.

Details

at line 56
public __construct(ObjectStateService $service, SignalDispatcher $signalDispatcher)

Constructor.

Construct service object from aggregated service and signal dispatcher

Parameters

ObjectStateService $service
SignalDispatcher $signalDispatcher

at line 72
public ObjectStateGroup createObjectStateGroup(ObjectStateGroupCreateStruct $objectStateGroupCreateStruct)

Creates a new object state group.

Parameters

ObjectStateGroupCreateStruct $objectStateGroupCreateStruct

Return Value

ObjectStateGroup

Exceptions

UnauthorizedException if the user is not allowed to create an object state group
InvalidArgumentException if the object state group with provided identifier already exists

at line 89
public ObjectStateGroup loadObjectStateGroup(mixed $objectStateGroupId, array $prioritizedLanguages = array())

Loads a object state group.

Parameters

mixed $objectStateGroupId
array $prioritizedLanguages Used as prioritized language code on translated properties of returned object.

Return Value

ObjectStateGroup

Exceptions

NotFoundException if the group was not found

at line 97
public ObjectStateGroup[] loadObjectStateGroups(int $offset, int $limit = -1, array $prioritizedLanguages = array())

Loads all object state groups.

Parameters

int $offset
int $limit
array $prioritizedLanguages Used as prioritized language code on translated properties of returned object.

Return Value

ObjectStateGroup[]

at line 105
public ObjectState[] loadObjectStates(ObjectStateGroup $objectStateGroup, array $prioritizedLanguages = array())

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

Parameters

ObjectStateGroup $objectStateGroup
array $prioritizedLanguages Used as prioritized language code on translated properties of returned object.

Return Value

ObjectState[]

at line 121
public ObjectStateGroup updateObjectStateGroup(ObjectStateGroup $objectStateGroup, ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct)

Updates an object state group.

Parameters

ObjectStateGroup $objectStateGroup
ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct

Return Value

ObjectStateGroup

Exceptions

UnauthorizedException if the user is not allowed to update an object state group
InvalidArgumentException if the object state group with provided identifier already exists

at line 142
public deleteObjectStateGroup(ObjectStateGroup $objectStateGroup)

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

Parameters

ObjectStateGroup $objectStateGroup

Exceptions

UnauthorizedException if the user is not allowed to delete an object state group

at line 170
public ObjectState createObjectState(ObjectStateGroup $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.

Parameters

ObjectStateGroup $objectStateGroup
ObjectStateCreateStruct $objectStateCreateStruct

Return Value

ObjectState

Exceptions

UnauthorizedException if the user is not allowed to create an object state
InvalidArgumentException if the object state with provided identifier already exists in the same group

at line 188
public ObjectState loadObjectState(mixed $stateId, array $prioritizedLanguages = array())

Loads an object state.

Parameters

mixed $stateId
array $prioritizedLanguages Used as prioritized language code on translated properties of returned object.

Return Value

ObjectState

Exceptions

NotFoundException if the state was not found

at line 204
public ObjectState updateObjectState(ObjectState $objectState, ObjectStateUpdateStruct $objectStateUpdateStruct)

Updates an object state.

Parameters

ObjectState $objectState
ObjectStateUpdateStruct $objectStateUpdateStruct

Return Value

ObjectState

Exceptions

UnauthorizedException if the user is not allowed to update an object state
InvalidArgumentException if the object state with provided identifier already exists in the same group

at line 226
public setPriorityOfObjectState(ObjectState $objectState, int $priority)

Changes the priority of the state.

Parameters

ObjectState $objectState
int $priority

Exceptions

UnauthorizedException if the user is not allowed to change priority on an object state

at line 249
public deleteObjectState(ObjectState $objectState)

Deletes a object state.

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

Parameters

ObjectState $objectState

Exceptions

UnauthorizedException if the user is not allowed to delete an object state

at line 273
public setContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup, ObjectState $objectState)

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

Parameters

ContentInfo $contentInfo
ObjectStateGroup $objectStateGroup
ObjectState $objectState

Exceptions

InvalidArgumentException if the object state does not belong to the given group
UnauthorizedException if the user is not allowed to change the object state

at line 299
public ObjectState getContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup)

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

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

Parameters

ContentInfo $contentInfo
ObjectStateGroup $objectStateGroup

Return Value

ObjectState

at line 311
public int getContentCount(ObjectState $objectState)

Returns the number of objects which are in this state.

Parameters

ObjectState $objectState

Return Value

int

at line 323
public ObjectStateGroupCreateStruct newObjectStateGroupCreateStruct(string $identifier)

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

Parameters

string $identifier

Return Value

ObjectStateGroupCreateStruct

at line 333
public ObjectStateGroupUpdateStruct newObjectStateGroupUpdateStruct()

Instantiates a new Object State Group Update Struct.

at line 345
public ObjectStateCreateStruct newObjectStateCreateStruct(string $identifier)

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

Parameters

string $identifier

Return Value

ObjectStateCreateStruct

at line 355
public ObjectStateUpdateStruct newObjectStateUpdateStruct()

Instantiates a new Object State Update Struct.