public function Statement::fetchAll

public Statement::fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL)

Returns an array containing all of the result set rows.

Parameters

$mode: One of the PDO::FETCH_* constants.

$column_index: If $mode is PDO::FETCH_COLUMN, the index of the column to fetch.

$constructor_arguments: If $mode is PDO::FETCH_CLASS, the arguments to pass to the constructor.

Return value

An array of results.

Overrides StatementInterface::fetchAll

File

core/lib/Drupal/Core/Database/Statement.php, line 167

Class

Statement
Default implementation of StatementInterface.

Namespace

Drupal\Core\Database

Code

public function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL) {
  // Call \PDOStatement::fetchAll to fetch all rows.
  // \PDOStatement is picky about the number of arguments in some cases so we
  // need to be pass the exact number of arguments we where given.
  switch (func_num_args()) {
    case 0:
      return parent::fetchAll();
    case 1:
      return parent::fetchAll($mode);
    case 2:
      return parent::fetchAll($mode, $column_index);
    case 3:
    default:
      return parent::fetchAll($mode, $column_index, $constructor_arguments);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Statement.php/function/Statement::fetchAll/8.1.x