eZ\Publish\Core\Repository\ObjectStateService::deleteObjectState PHP Method

deleteObjectState() public method

Deletes a object state. The state of the content objects is reset to the first object state in the group.
public deleteObjectState ( eZ\Publish\API\Repository\Values\ObjectState\ObjectState $objectState )
$objectState eZ\Publish\API\Repository\Values\ObjectState\ObjectState
    public function deleteObjectState(APIObjectState $objectState)
    {
        if ($this->repository->hasAccess('state', 'administrate') !== true) {
            throw new UnauthorizedException('state', 'administrate');
        }
        $loadedObjectState = $this->loadObjectState($objectState->id);
        $this->repository->beginTransaction();
        try {
            $this->objectStateHandler->delete($loadedObjectState->id);
            $this->repository->commit();
        } catch (Exception $e) {
            $this->repository->rollback();
            throw $e;
        }
    }