. */ namespace SP\Domain\User; use SP\Core\Exceptions\ConstraintException; use SP\Core\Exceptions\QueryException; /** * Class UserToUserGroupService * * @package SP\Domain\Common\Services\UserGroup */ interface UserToUserGroupServiceInterface { /** * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function add(int $id, array $users): int; /** * @throws ConstraintException * @throws QueryException */ public function update(int $id, array $users): int; /** * @throws ConstraintException * @throws QueryException */ public function getUsersByGroupId(int $id): array; /** * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Infrastructure\Common\Repositories\NoSuchItemException */ public function getById(int $id): array; /** * Checks whether the user is included in the group * * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function checkUserInGroup(int $groupId, int $userId): bool; /** * Returns the groups which the user belongs to * * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function getGroupsForUser(int $userId): array; }