. */ namespace SP\Domain\Account\Services; use SP\Core\Application; use SP\Domain\Account\Ports\AccountToUserGroupRepository; use SP\Domain\Account\Ports\AccountToUserGroupService; use SP\Domain\Common\Models\Item; use SP\Domain\Common\Services\Service; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; use SP\Domain\Core\Exceptions\SPException; /** * Class AccountToUserGroup */ final class AccountToUserGroup extends Service implements AccountToUserGroupService { public function __construct( Application $application, private readonly AccountToUserGroupRepository $accountToUserGroupRepository ) { parent::__construct($application); } /** * @param int $id * * @return Item[] * @throws ConstraintException * @throws QueryException * @throws SPException */ public function getUserGroupsByAccountId(int $id): array { return $this->accountToUserGroupRepository->getUserGroupsByAccountId($id)->getDataAsArray( Item::class ); } }