function StatementPrefetch::fetchAll
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Database/StatementPrefetch.php \Drupal\Core\Database\StatementPrefetch::fetchAll()
- 10 core/lib/Drupal/Core/Database/StatementPrefetch.php \Drupal\Core\Database\StatementPrefetch::fetchAll()
Overrides StatementInterface::fetchAll
File
-
core/
lib/ Drupal/ Core/ Database/ StatementPrefetch.php, line 524
Class
- StatementPrefetch
- An implementation of StatementInterface that prefetches all data.
Namespace
Drupal\Core\DatabaseCode
public function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL) {
$this->fetchStyle = $mode ?? $this->defaultFetchStyle;
$this->fetchOptions = $this->defaultFetchOptions;
if (isset($column_index)) {
$this->fetchOptions['column'] = $column_index;
}
if (isset($constructor_arguments)) {
$this->fetchOptions['constructor_args'] = $constructor_arguments;
}
$result = [];
// Traverse the array as PHP would have done.
while (isset($this->currentRow)) {
// Grab the row in the format specified above.
$result[] = $this->current();
$this->next();
}
// Reset the fetch parameters to the value stored using setFetchMode().
$this->fetchStyle = $this->defaultFetchStyle;
$this->fetchOptions = $this->defaultFetchOptions;
return $result;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.