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