function StatementBase::fetch
Overrides StatementInterface::fetch
1 call to StatementBase::fetch()
- StatementBase::fetchAssoc in core/
lib/ Drupal/ Core/ Database/ Statement/ StatementBase.php - Fetches the next row and returns it as an associative array.
File
-
core/
lib/ Drupal/ Core/ Database/ Statement/ StatementBase.php, line 218
Class
- StatementBase
- StatementInterface base implementation.
Namespace
Drupal\Core\Database\StatementCode
public function fetch($mode = NULL, $cursorOrientation = NULL, $cursorOffset = NULL) {
if (is_int($mode)) {
@trigger_error("Passing the \$mode argument as an integer to fetch() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use a case of \\Drupal\\Core\\Database\\FetchAs enum instead. See https://www.drupal.org/node/3488338", E_USER_DEPRECATED);
$mode = $this->pdoToFetchAs($mode);
}
assert($mode === NULL || $mode instanceof FetchAs);
$fetchOptions = match (func_num_args()) { 0 => $this->fetchOptions,
1 => $this->fetchOptions,
2 => $this->fetchOptions + [
'cursor_orientation' => $cursorOrientation,
],
default => $this->fetchOptions + [
'cursor_orientation' => $cursorOrientation,
'cursor_offset' => $cursorOffset,
],
};
$row = $this->result
->fetch($mode ?? $this->fetchMode, $fetchOptions);
if ($row === FALSE) {
$this->markResultsetFetchingComplete();
return FALSE;
}
$this->setResultsetCurrentRow($row);
return $row;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.