Пример #1
0
 /**
  * Updates an object state group.
  *
  * @param $objectStateGroupId
  *
  * @throws \eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException
  *
  * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup
  */
 public function updateObjectStateGroup($objectStateGroupId, Request $request)
 {
     $updateStruct = $this->inputDispatcher->parse(new Message(array('Content-Type' => $request->headers->get('Content-Type')), $request->getContent()));
     $objectStateGroup = $this->objectStateService->loadObjectStateGroup($objectStateGroupId);
     try {
         $updatedStateGroup = $this->objectStateService->updateObjectStateGroup($objectStateGroup, $updateStruct);
         return $updatedStateGroup;
     } catch (InvalidArgumentException $e) {
         throw new ForbiddenException($e->getMessage());
     }
 }
Пример #2
0
 /**
  * Updates an object state group.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update an object state group
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the object state group with provided identifier already exists
  *
  * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup
  * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct
  *
  * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup
  */
 public function updateObjectStateGroup(ObjectStateGroup $objectStateGroup, ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct)
 {
     $returnValue = $this->service->updateObjectStateGroup($objectStateGroup, $objectStateGroupUpdateStruct);
     $this->signalDispatcher->emit(new UpdateObjectStateGroupSignal(array('objectStateGroupId' => $objectStateGroup->id)));
     return $returnValue;
 }