f7cloud_client/apps/circles/lib/Db/AccountsRequest.php
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

79 lines
1.4 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2017 F7cloud GmbH and F7cloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Circles\Db;
use OCA\Circles\Exceptions\MemberDoesNotExistException;
use OCA\Circles\Tools\Traits\TStringTools;
class AccountsRequest extends AccountsRequestBuilder {
use TStringTools;
public function getAccountData(string $userId): array {
$qb = $this->getAccountsSelectSql();
$this->limitToDBField($qb, 'uid', $userId);
$cursor = $qb->execute();
$data = $cursor->fetch();
$cursor->closeCursor();
if ($data === false) {
return [];
}
return $this->parseAccountsSelectSql($data);
}
/**
* @param string $userId
*
* @deprecated
* @return array
* @throws MemberDoesNotExistException
*/
public function getFromUserId(string $userId): array {
$qb = $this->getAccountsSelectSql();
$this->limitToDBField($qb, 'uid', $userId);
$cursor = $qb->execute();
$data = $cursor->fetch();
$cursor->closeCursor();
if ($data === false) {
throw new MemberDoesNotExistException();
}
return $this->parseAccountsSelectSql($data);
}
/**
* @deprecated
* @return array
*/
public function getAll(): array {
$qb = $this->getAccountsSelectSql();
$accounts = [];
$cursor = $qb->execute();
while ($data = $cursor->fetch()) {
$account = $this->parseAccountsSelectSql($data);
$accounts[$account['userId']] = $account;
}
$cursor->closeCursor();
return $accounts;
}
}