public function setPriorityOfObjectState(APIObjectState $objectState, $priority)
{
if (!is_int($priority)) {
throw new InvalidArgumentValue('priority', $priority);
}
if ($this->repository->hasAccess('state', 'administrate') !== true) {
throw new UnauthorizedException('state', 'administrate');
}
$loadedObjectState = $this->loadObjectState($objectState->id);
$this->repository->beginTransaction();
try {
$this->objectStateHandler->setPriority($loadedObjectState->id, $priority);
$this->repository->commit();
} catch (Exception $e) {
$this->repository->rollback();
throw $e;
}
}