/** * Creates a new object state group. * * @throws \eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException * * @return \eZ\Publish\Core\REST\Server\Values\CreatedObjectStateGroup */ public function createObjectStateGroup(Request $request) { try { $createdStateGroup = $this->objectStateService->createObjectStateGroup($this->inputDispatcher->parse(new Message(array('Content-Type' => $request->headers->get('Content-Type')), $request->getContent()))); } catch (InvalidArgumentException $e) { throw new ForbiddenException($e->getMessage()); } return new Values\CreatedObjectStateGroup(array('objectStateGroup' => $createdStateGroup)); }
/** * Creates a new object state group. * * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create 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\ObjectStateGroupCreateStruct $objectStateGroupCreateStruct * * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup */ public function createObjectStateGroup(ObjectStateGroupCreateStruct $objectStateGroupCreateStruct) { $returnValue = $this->service->createObjectStateGroup($objectStateGroupCreateStruct); $this->signalDispatcher->emit(new CreateObjectStateGroupSignal(array('objectStateGroupId' => $returnValue->id))); return $returnValue; }