|
@@ 138-164 (lines=27) @@
|
| 135 |
|
); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
public function createObjectState( |
| 139 |
|
ObjectStateGroup $objectStateGroup, |
| 140 |
|
ObjectStateCreateStruct $objectStateCreateStruct |
| 141 |
|
): ObjectState { |
| 142 |
|
$eventData = [ |
| 143 |
|
$objectStateGroup, |
| 144 |
|
$objectStateCreateStruct, |
| 145 |
|
]; |
| 146 |
|
|
| 147 |
|
$beforeEvent = new BeforeCreateObjectStateEvent(...$eventData); |
| 148 |
|
|
| 149 |
|
$this->eventDispatcher->dispatch($beforeEvent, BeforeCreateObjectStateEventInterface::class); |
| 150 |
|
if ($beforeEvent->isPropagationStopped()) { |
| 151 |
|
return $beforeEvent->getObjectState(); |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
$objectState = $beforeEvent->hasObjectState() |
| 155 |
|
? $beforeEvent->getObjectState() |
| 156 |
|
: $this->innerService->createObjectState($objectStateGroup, $objectStateCreateStruct); |
| 157 |
|
|
| 158 |
|
$this->eventDispatcher->dispatch( |
| 159 |
|
new CreateObjectStateEvent($objectState, ...$eventData), |
| 160 |
|
CreateObjectStateEventInterface::class |
| 161 |
|
); |
| 162 |
|
|
| 163 |
|
return $objectState; |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
public function updateObjectState( |
| 167 |
|
ObjectState $objectState, |
|
@@ 166-192 (lines=27) @@
|
| 163 |
|
return $objectState; |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
public function updateObjectState( |
| 167 |
|
ObjectState $objectState, |
| 168 |
|
ObjectStateUpdateStruct $objectStateUpdateStruct |
| 169 |
|
): ObjectState { |
| 170 |
|
$eventData = [ |
| 171 |
|
$objectState, |
| 172 |
|
$objectStateUpdateStruct, |
| 173 |
|
]; |
| 174 |
|
|
| 175 |
|
$beforeEvent = new BeforeUpdateObjectStateEvent(...$eventData); |
| 176 |
|
|
| 177 |
|
$this->eventDispatcher->dispatch($beforeEvent, BeforeUpdateObjectStateEventInterface::class); |
| 178 |
|
if ($beforeEvent->isPropagationStopped()) { |
| 179 |
|
return $beforeEvent->getUpdatedObjectState(); |
| 180 |
|
} |
| 181 |
|
|
| 182 |
|
$updatedObjectState = $beforeEvent->hasUpdatedObjectState() |
| 183 |
|
? $beforeEvent->getUpdatedObjectState() |
| 184 |
|
: $this->innerService->updateObjectState($objectState, $objectStateUpdateStruct); |
| 185 |
|
|
| 186 |
|
$this->eventDispatcher->dispatch( |
| 187 |
|
new UpdateObjectStateEvent($updatedObjectState, ...$eventData), |
| 188 |
|
UpdateObjectStateEventInterface::class |
| 189 |
|
); |
| 190 |
|
|
| 191 |
|
return $updatedObjectState; |
| 192 |
|
} |
| 193 |
|
|
| 194 |
|
public function setPriorityOfObjectState( |
| 195 |
|
ObjectState $objectState, |