function PdoResult::fetchAll
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Database/Statement/PdoResult.php \Drupal\Core\Database\Statement\PdoResult::fetchAll()
Returns an array containing all of the result set rows.
Parameters
\Drupal\Core\Database\Statement\FetchAs $mode: One of the cases of the FetchAs enum.
array{class?: class-string, constructor_args?: list<mixed>, column?: int, cursor_orientation?: int, cursor_offset?: int} $fetchOptions: An array of fetch options.
Return value
array An array of results.
Overrides ResultBase::fetchAll
File
-
core/
lib/ Drupal/ Core/ Database/ Statement/ PdoResult.php, line 76
Class
- PdoResult
- Class for PDO-provided results of a data query language (DQL) statement.
Namespace
Drupal\Core\Database\StatementCode
public function fetchAll(FetchAs $mode, array $fetchOptions) : array {
return $this->clientFetchAll($mode, ...match ($mode) { FetchAs::Column => [
$fetchOptions['column'] ?? NULL,
],
FetchAs::ClassObject => [
$fetchOptions['class'] ?? NULL,
$fetchOptions['constructor_args'] ?? NULL,
],
default => [],
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.