function StatementPrefetchIterator::fetchAllAssoc

Same name in other branches
  1. 10 core/lib/Drupal/Core/Database/StatementPrefetchIterator.php \Drupal\Core\Database\StatementPrefetchIterator::fetchAllAssoc()

Overrides StatementInterface::fetchAllAssoc

File

core/lib/Drupal/Core/Database/StatementPrefetchIterator.php, line 353

Class

StatementPrefetchIterator
An implementation of StatementInterface that prefetches all data.

Namespace

Drupal\Core\Database

Code

public function fetchAllAssoc($key, $fetch_style = NULL) {
    $fetchStyle = $fetch_style ?? $this->defaultFetchStyle;
    $result = [];
    while ($row = $this->fetch($fetchStyle)) {
        $result[$this->data[$this->getResultsetCurrentRowIndex()][$key]] = $row;
    }
    return $result;
}

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