/** * Updates an object state. * * @param $objectStateGroupId * @param $objectStateId * * @throws \eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException * * @return \eZ\Publish\Core\REST\Common\Values\RestObjectState */ public function updateObjectState($objectStateGroupId, $objectStateId, Request $request) { $updateStruct = $this->inputDispatcher->parse(new Message(array('Content-Type' => $request->headers->get('Content-Type')), $request->getContent())); $objectState = $this->objectStateService->loadObjectState($objectStateId); try { $updatedObjectState = $this->objectStateService->updateObjectState($objectState, $updateStruct); return new RestObjectState($updatedObjectState, $objectStateGroupId); } catch (InvalidArgumentException $e) { throw new ForbiddenException($e->getMessage()); } }
/** * Loads an object state. * * @param mixed $stateId * * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if the state was not found * * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectState */ public function loadObjectState($stateId) { return $this->service->loadObjectState($stateId); }