|
@@ 220-238 (lines=19) @@
|
| 217 |
|
* |
| 218 |
|
* @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup |
| 219 |
|
*/ |
| 220 |
|
public function updateObjectStateGroup($objectStateGroupId, Request $request) |
| 221 |
|
{ |
| 222 |
|
$updateStruct = $this->inputDispatcher->parse( |
| 223 |
|
new Message( |
| 224 |
|
array('Content-Type' => $request->headers->get('Content-Type')), |
| 225 |
|
$request->getContent() |
| 226 |
|
) |
| 227 |
|
); |
| 228 |
|
|
| 229 |
|
$objectStateGroup = $this->objectStateService->loadObjectStateGroup($objectStateGroupId); |
| 230 |
|
|
| 231 |
|
try { |
| 232 |
|
$updatedStateGroup = $this->objectStateService->updateObjectStateGroup($objectStateGroup, $updateStruct); |
| 233 |
|
|
| 234 |
|
return $updatedStateGroup; |
| 235 |
|
} catch (InvalidArgumentException $e) { |
| 236 |
|
throw new ForbiddenException($e->getMessage()); |
| 237 |
|
} |
| 238 |
|
} |
| 239 |
|
|
| 240 |
|
/** |
| 241 |
|
* Updates an object state. |
|
@@ 250-268 (lines=19) @@
|
| 247 |
|
* |
| 248 |
|
* @return \eZ\Publish\Core\REST\Common\Values\RestObjectState |
| 249 |
|
*/ |
| 250 |
|
public function updateObjectState($objectStateGroupId, $objectStateId, Request $request) |
| 251 |
|
{ |
| 252 |
|
$updateStruct = $this->inputDispatcher->parse( |
| 253 |
|
new Message( |
| 254 |
|
array('Content-Type' => $request->headers->get('Content-Type')), |
| 255 |
|
$request->getContent() |
| 256 |
|
) |
| 257 |
|
); |
| 258 |
|
|
| 259 |
|
$objectState = $this->objectStateService->loadObjectState($objectStateId); |
| 260 |
|
|
| 261 |
|
try { |
| 262 |
|
$updatedObjectState = $this->objectStateService->updateObjectState($objectState, $updateStruct); |
| 263 |
|
|
| 264 |
|
return new RestObjectState($updatedObjectState, $objectStateGroupId); |
| 265 |
|
} catch (InvalidArgumentException $e) { |
| 266 |
|
throw new ForbiddenException($e->getMessage()); |
| 267 |
|
} |
| 268 |
|
} |
| 269 |
|
|
| 270 |
|
/** |
| 271 |
|
* Returns the object states of content. |