Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Core/SignalSlot/ObjectStateService.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\SignalSlot;
8
9 use eZ\Publish\API\Repository\ObjectStateService as ObjectStateServiceInterface;
10 use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateCreateStruct;
11 use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupCreateStruct;
12 use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct;
13 use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateUpdateStruct;
14 use eZ\Publish\API\Repository\Values\ObjectState\ObjectState;
15 use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup;
16 use eZ\Publish\API\Repository\Values\Content\ContentInfo;
17 use eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\CreateObjectStateGroupSignal;
18 use eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\UpdateObjectStateGroupSignal;
19 use eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\DeleteObjectStateGroupSignal;
20 use eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\CreateObjectStateSignal;
21 use eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\UpdateObjectStateSignal;
22 use eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\SetPriorityOfObjectStateSignal;
23 use eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\DeleteObjectStateSignal;
24 use eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\SetContentStateSignal;
25
29 class ObjectStateService implements ObjectStateServiceInterface
30 {
36 protected $service;
37
43 protected $signalDispatcher;
44
54 public function __construct(ObjectStateServiceInterface $service, SignalDispatcher $signalDispatcher)
55 {
56 $this->service = $service;
57 $this->signalDispatcher = $signalDispatcher;
58 }
59
70 public function createObjectStateGroup(ObjectStateGroupCreateStruct $objectStateGroupCreateStruct)
71 {
72 $returnValue = $this->service->createObjectStateGroup($objectStateGroupCreateStruct);
73 $this->signalDispatcher->emit(
74 new CreateObjectStateGroupSignal(
75 [
76 'objectStateGroupId' => $returnValue->id,
77 ]
78 )
79 );
80
81 return $returnValue;
82 }
83
87 public function loadObjectStateGroup($objectStateGroupId, array $prioritizedLanguages = [])
88 {
89 return $this->service->loadObjectStateGroup($objectStateGroupId, $prioritizedLanguages);
90 }
91
95 public function loadObjectStateGroups($offset = 0, $limit = -1, array $prioritizedLanguages = [])
96 {
97 return $this->service->loadObjectStateGroups($offset, $limit, $prioritizedLanguages);
98 }
99
103 public function loadObjectStates(ObjectStateGroup $objectStateGroup, array $prioritizedLanguages = [])
104 {
105 return $this->service->loadObjectStates($objectStateGroup, $prioritizedLanguages);
106 }
107
119 public function updateObjectStateGroup(ObjectStateGroup $objectStateGroup, ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct)
120 {
121 $returnValue = $this->service->updateObjectStateGroup($objectStateGroup, $objectStateGroupUpdateStruct);
122 $this->signalDispatcher->emit(
123 new UpdateObjectStateGroupSignal(
124 [
125 'objectStateGroupId' => $objectStateGroup->id,
126 ]
127 )
128 );
129
130 return $returnValue;
131 }
132
140 public function deleteObjectStateGroup(ObjectStateGroup $objectStateGroup)
141 {
142 $returnValue = $this->service->deleteObjectStateGroup($objectStateGroup);
143 $this->signalDispatcher->emit(
144 new DeleteObjectStateGroupSignal(
145 [
146 'objectStateGroupId' => $objectStateGroup->id,
147 ]
148 )
149 );
150
151 return $returnValue;
152 }
153
168 public function createObjectState(ObjectStateGroup $objectStateGroup, ObjectStateCreateStruct $objectStateCreateStruct)
169 {
170 $returnValue = $this->service->createObjectState($objectStateGroup, $objectStateCreateStruct);
171 $this->signalDispatcher->emit(
172 new CreateObjectStateSignal(
173 [
174 'objectStateGroupId' => $objectStateGroup->id,
175 'objectStateId' => $returnValue->id,
176 ]
177 )
178 );
179
180 return $returnValue;
181 }
182
186 public function loadObjectState($stateId, array $prioritizedLanguages = [])
187 {
188 return $this->service->loadObjectState($stateId, $prioritizedLanguages);
189 }
190
202 public function updateObjectState(ObjectState $objectState, ObjectStateUpdateStruct $objectStateUpdateStruct)
203 {
204 $returnValue = $this->service->updateObjectState($objectState, $objectStateUpdateStruct);
205 $this->signalDispatcher->emit(
206 new UpdateObjectStateSignal(
207 [
208 'objectStateId' => $objectState->id,
209 ]
210 )
211 );
212
213 return $returnValue;
214 }
215
224 public function setPriorityOfObjectState(ObjectState $objectState, $priority)
225 {
226 $returnValue = $this->service->setPriorityOfObjectState($objectState, $priority);
227 $this->signalDispatcher->emit(
228 new SetPriorityOfObjectStateSignal(
229 [
230 'objectStateId' => $objectState->id,
231 'priority' => $priority,
232 ]
233 )
234 );
235
236 return $returnValue;
237 }
238
247 public function deleteObjectState(ObjectState $objectState)
248 {
249 $returnValue = $this->service->deleteObjectState($objectState);
250 $this->signalDispatcher->emit(
251 new DeleteObjectStateSignal(
252 [
253 'objectStateId' => $objectState->id,
254 ]
255 )
256 );
257
258 return $returnValue;
259 }
260
271 public function setContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup, ObjectState $objectState)
272 {
273 $returnValue = $this->service->setContentState($contentInfo, $objectStateGroup, $objectState);
274 $this->signalDispatcher->emit(
275 new SetContentStateSignal(
276 [
277 'contentId' => $contentInfo->id,
278 'objectStateGroupId' => $objectStateGroup->id,
279 'objectStateId' => $objectState->id,
280 ]
281 )
282 );
283
284 return $returnValue;
285 }
286
297 public function getContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup)
298 {
299 return $this->service->getContentState($contentInfo, $objectStateGroup);
300 }
301
309 public function getContentCount(ObjectState $objectState)
310 {
311 return $this->service->getContentCount($objectState);
312 }
313
321 public function newObjectStateGroupCreateStruct($identifier)
322 {
323 return $this->service->newObjectStateGroupCreateStruct($identifier);
324 }
325
331 public function newObjectStateGroupUpdateStruct()
332 {
333 return $this->service->newObjectStateGroupUpdateStruct();
334 }
335
343 public function newObjectStateCreateStruct($identifier)
344 {
345 return $this->service->newObjectStateCreateStruct($identifier);
346 }
347
353 public function newObjectStateUpdateStruct()
354 {
355 return $this->service->newObjectStateUpdateStruct();
356 }
357 }
eZ\Publish\API\Repository\Values\Content\ContentInfo
Definition: API/Repository/Values/Content/ContentInfo.php:31
eZ\Publish\API\Repository\Values\ObjectState\ObjectStateCreateStruct
This class represents a value for creating object states.
Definition: API/Repository/Values/ObjectState/ObjectStateCreateStruct.php:15
eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupCreateStruct
This class represents a value for creating object state groups.
Definition: API/Repository/Values/ObjectState/ObjectStateGroupCreateStruct.php:15
eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct
This class represents a value for updating object state groups.
Definition: API/Repository/Values/ObjectState/ObjectStateGroupUpdateStruct.php:15
eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup
Definition: API/Repository/Values/ObjectState/ObjectStateGroup.php:22
eZ\Publish\API\Repository\Values\ObjectState\ObjectStateUpdateStruct
This class represents a value for updating object states.
Definition: API/Repository/Values/ObjectState/ObjectStateUpdateStruct.php:15
eZ\Publish\API\Repository\Values\ObjectState\ObjectState
Definition: API/Repository/Values/ObjectState/ObjectState.php:23
eZ\Publish\Core\SignalSlot\ObjectStateService
ObjectStateService class.
Definition: Core/SignalSlot/ObjectStateService.php:30
eZ\Publish\Core\SignalSlot\ObjectStateService\getContentCount
getContentCount(ObjectState $objectState)
Returns the number of objects which are in this state.
Definition: Core/SignalSlot/ObjectStateService.php:309
eZ\Publish\Core\SignalSlot\ObjectStateService\$service
$service
Definition: Core/SignalSlot/ObjectStateService.php:36
eZ\Publish\Core\SignalSlot\ObjectStateService\loadObjectStates
loadObjectStates(ObjectStateGroup $objectStateGroup, array $prioritizedLanguages=[])
{This method returns the ordered list of object states of a group.Used as prioritized language code o...
Definition: Core/SignalSlot/ObjectStateService.php:103
eZ\Publish\Core\SignalSlot\ObjectStateService\loadObjectStateGroups
loadObjectStateGroups($offset=0, $limit=-1, array $prioritizedLanguages=[])
{Loads all object state groups.Used as prioritized language code on translated properties of returned...
Definition: Core/SignalSlot/ObjectStateService.php:95
eZ\Publish\Core\SignalSlot\ObjectStateService\getContentState
getContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup)
Gets the object-state of object identified by $contentId.
Definition: Core/SignalSlot/ObjectStateService.php:297
eZ\Publish\Core\SignalSlot\ObjectStateService\$signalDispatcher
$signalDispatcher
Definition: Core/SignalSlot/ObjectStateService.php:43
eZ\Publish\Core\SignalSlot\ObjectStateService\newObjectStateGroupUpdateStruct
newObjectStateGroupUpdateStruct()
Instantiates a new Object State Group Update Struct.
Definition: Core/SignalSlot/ObjectStateService.php:331
eZ\Publish\Core\SignalSlot\ObjectStateService\loadObjectState
loadObjectState($stateId, array $prioritizedLanguages=[])
{Loads an object state.Used as prioritized language code on translated properties of returned object....
Definition: Core/SignalSlot/ObjectStateService.php:186
eZ\Publish\Core\SignalSlot\ObjectStateService\__construct
__construct(ObjectStateServiceInterface $service, SignalDispatcher $signalDispatcher)
Constructor.
Definition: Core/SignalSlot/ObjectStateService.php:54
eZ\Publish\Core\SignalSlot\ObjectStateService\deleteObjectState
deleteObjectState(ObjectState $objectState)
Deletes a object state.
Definition: Core/SignalSlot/ObjectStateService.php:247
eZ\Publish\Core\SignalSlot\ObjectStateService\updateObjectState
updateObjectState(ObjectState $objectState, ObjectStateUpdateStruct $objectStateUpdateStruct)
Updates an object state.
Definition: Core/SignalSlot/ObjectStateService.php:202
eZ\Publish\Core\SignalSlot\ObjectStateService\updateObjectStateGroup
updateObjectStateGroup(ObjectStateGroup $objectStateGroup, ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct)
Updates an object state group.
Definition: Core/SignalSlot/ObjectStateService.php:119
eZ\Publish\Core\SignalSlot\ObjectStateService\newObjectStateCreateStruct
newObjectStateCreateStruct($identifier)
Instantiates a new Object State Create Struct and sets $identifier in it.
Definition: Core/SignalSlot/ObjectStateService.php:343
eZ\Publish\Core\SignalSlot\ObjectStateService\setContentState
setContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup, ObjectState $objectState)
Sets the object-state of a state group to $state for the given content.
Definition: Core/SignalSlot/ObjectStateService.php:271
eZ\Publish\Core\SignalSlot\ObjectStateService\createObjectStateGroup
createObjectStateGroup(ObjectStateGroupCreateStruct $objectStateGroupCreateStruct)
Creates a new object state group.
Definition: Core/SignalSlot/ObjectStateService.php:70
eZ\Publish\Core\SignalSlot\ObjectStateService\setPriorityOfObjectState
setPriorityOfObjectState(ObjectState $objectState, $priority)
Changes the priority of the state.
Definition: Core/SignalSlot/ObjectStateService.php:224
eZ\Publish\Core\SignalSlot\ObjectStateService\deleteObjectStateGroup
deleteObjectStateGroup(ObjectStateGroup $objectStateGroup)
Deletes a object state group including all states and links to content.
Definition: Core/SignalSlot/ObjectStateService.php:140
eZ\Publish\Core\SignalSlot\ObjectStateService\createObjectState
createObjectState(ObjectStateGroup $objectStateGroup, ObjectStateCreateStruct $objectStateCreateStruct)
Creates a new object state in the given group.
Definition: Core/SignalSlot/ObjectStateService.php:168
eZ\Publish\Core\SignalSlot\ObjectStateService\newObjectStateGroupCreateStruct
newObjectStateGroupCreateStruct($identifier)
Instantiates a new Object State Group Create Struct and sets $identified in it.
Definition: Core/SignalSlot/ObjectStateService.php:321
eZ\Publish\Core\SignalSlot\ObjectStateService\loadObjectStateGroup
loadObjectStateGroup($objectStateGroupId, array $prioritizedLanguages=[])
{Loads a object state group.Used as prioritized language code on translated properties of returned ob...
Definition: Core/SignalSlot/ObjectStateService.php:87
eZ\Publish\Core\SignalSlot\ObjectStateService\newObjectStateUpdateStruct
newObjectStateUpdateStruct()
Instantiates a new Object State Update Struct.
Definition: Core/SignalSlot/ObjectStateService.php:353
eZ\Publish\Core\SignalSlot\SignalDispatcher
Dispatches Signals to their assigned Slots.
Definition: SignalDispatcher.php:20
eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\CreateObjectStateGroupSignal
CreateObjectStateGroupSignal class.
Definition: CreateObjectStateGroupSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\CreateObjectStateSignal
CreateObjectStateSignal class.
Definition: CreateObjectStateSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\DeleteObjectStateGroupSignal
DeleteObjectStateGroupSignal class.
Definition: DeleteObjectStateGroupSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\DeleteObjectStateSignal
DeleteObjectStateSignal class.
Definition: DeleteObjectStateSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\SetContentStateSignal
SetContentStateSignal class.
Definition: SetContentStateSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\SetPriorityOfObjectStateSignal
SetPriorityOfObjectStateSignal class.
Definition: SetPriorityOfObjectStateSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\UpdateObjectStateGroupSignal
UpdateObjectStateGroupSignal class.
Definition: UpdateObjectStateGroupSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\ObjectStateService\UpdateObjectStateSignal
UpdateObjectStateSignal class.
Definition: UpdateObjectStateSignal.php:15
eZ\Publish\API\Repository\ObjectStateService
Definition: API/Repository/ObjectStateService.php:23
eZ\Publish\Core\SignalSlot
Definition: Core/SignalSlot/BookmarkService.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.