function PrefetchedResult::__construct

Constructor.

Parameters

\Drupal\Core\Database\Statement\FetchAs $fetchMode: The fetch mode.

array{class: class-string, constructor_args: list<mixed>, column: int, cursor_orientation?: int, cursor_offset?: int} $fetchOptions: The fetch options.

array $data: The prefetched data, in FetchAs::Associative format.

int|null $rowCount: The row count.

Overrides ResultBase::__construct

File

core/lib/Drupal/Core/Database/Statement/PrefetchedResult.php, line 38

Class

PrefetchedResult
Class for prefetched results of a data query language (DQL) statement.

Namespace

Drupal\Core\Database\Statement

Code

public function __construct(FetchAs $fetchMode, array $fetchOptions, array $data, ?int $rowCount) {
    parent::__construct($fetchMode, $fetchOptions);
    $this->columnNames = isset($this->data[0]) ? array_keys($this->data[0]) : [];
    $this->currentRowIndex = -1;
}

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