function ResultBase::fetch

Fetches the next row.

Parameters

\Drupal\Core\Database\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|object|int|float|string|bool|null A result, formatted according to $mode, or FALSE on failure.

3 calls to ResultBase::fetch()
ResultBase::fetchAll in core/lib/Drupal/Core/Database/Statement/ResultBase.php
Returns an array containing all of the result set rows.
ResultBase::fetchAllAssoc in core/lib/Drupal/Core/Database/Statement/ResultBase.php
Returns the result set as an associative array keyed by the given column.
ResultBase::fetchAllKeyed in core/lib/Drupal/Core/Database/Statement/ResultBase.php
Returns the entire result set as a single associative array.
2 methods override ResultBase::fetch()
PdoResult::fetch in core/lib/Drupal/Core/Database/Statement/PdoResult.php
Fetches the next row.
PrefetchedResult::fetch in core/lib/Drupal/Core/Database/Statement/PrefetchedResult.php
Fetches the next row.

File

core/lib/Drupal/Core/Database/Statement/ResultBase.php, line 66

Class

ResultBase
Base class for results of a data query language (DQL) statement.

Namespace

Drupal\Core\Database\Statement

Code

public abstract function fetch(FetchAs $mode, array $fetchOptions) : array|object|int|float|string|bool|null;

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.