mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix(db): Fix internal calls to doctrine's fetch() methods
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
a4c1d7291f
commit
11e84b8968
1 changed files with 12 additions and 5 deletions
|
|
@ -30,14 +30,21 @@ class ResultAdapter implements IResult {
|
|||
}
|
||||
|
||||
public function fetch(int $fetchMode = PDO::FETCH_ASSOC) {
|
||||
return $this->inner->fetch($fetchMode);
|
||||
return match ($fetchMode) {
|
||||
PDO::FETCH_ASSOC => $this->inner->fetchAssociative(),
|
||||
PDO::FETCH_NUM => $this->inner->fetchNumeric(),
|
||||
PDO::FETCH_COLUMN => $this->inner->fetchOne(),
|
||||
default => throw new \Exception('Fetch mode needs to be assoc, num or column.'),
|
||||
};
|
||||
}
|
||||
|
||||
public function fetchAll(int $fetchMode = PDO::FETCH_ASSOC): array {
|
||||
if ($fetchMode !== PDO::FETCH_ASSOC && $fetchMode !== PDO::FETCH_NUM && $fetchMode !== PDO::FETCH_COLUMN) {
|
||||
throw new \Exception('Fetch mode needs to be assoc, num or column.');
|
||||
}
|
||||
return $this->inner->fetchAll($fetchMode);
|
||||
return match ($fetchMode) {
|
||||
PDO::FETCH_ASSOC => $this->inner->fetchAllAssociative(),
|
||||
PDO::FETCH_NUM => $this->inner->fetchAllNumeric(),
|
||||
PDO::FETCH_COLUMN => $this->inner->fetchFirstColumn(),
|
||||
default => throw new \Exception('Fetch mode needs to be assoc, num or column.'),
|
||||
};
|
||||
}
|
||||
|
||||
public function fetchColumn($columnIndex = 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue