eZ\Publish\Core\REST\Server\Controller\ObjectState::createObjectState PHP Method

createObjectState() public method

Creates a new object state.
public createObjectState ( $objectStateGroupId, Request $request ) : CreatedObjectState
$objectStateGroupId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\CreatedObjectState
    public function createObjectState($objectStateGroupId, Request $request)
    {
        $objectStateGroup = $this->objectStateService->loadObjectStateGroup($objectStateGroupId);
        try {
            $createdObjectState = $this->objectStateService->createObjectState($objectStateGroup, $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\CreatedObjectState(array('objectState' => new RestObjectState($createdObjectState, $objectStateGroup->id)));
    }