function StatementInterface::fetchAllKeyed
Same name in other branches
- 9 core/lib/Drupal/Core/Database/StatementInterface.php \Drupal\Core\Database\StatementInterface::fetchAllKeyed()
- 8.9.x core/lib/Drupal/Core/Database/StatementInterface.php \Drupal\Core\Database\StatementInterface::fetchAllKeyed()
- 11.x core/lib/Drupal/Core/Database/StatementInterface.php \Drupal\Core\Database\StatementInterface::fetchAllKeyed()
Returns the entire result set as a single associative array.
This method is only useful for two-column result sets. It will return an associative array where the key is one column from the result set and the value is another field. In most cases, the default of the first two columns is appropriate.
Note that this method will run the result set to the end.
Parameters
$key_index: The numeric index of the field to use as the array key.
$value_index: The numeric index of the field to use as the array value.
Return value
array An associative array, or an empty array if there is no result set.
4 methods override StatementInterface::fetchAllKeyed()
- StatementPrefetch::fetchAllKeyed in core/
lib/ Drupal/ Core/ Database/ StatementPrefetch.php - Returns the entire result set as a single associative array.
- StatementPrefetchIterator::fetchAllKeyed in core/
lib/ Drupal/ Core/ Database/ StatementPrefetchIterator.php - Returns the entire result set as a single associative array.
- StatementWrapper::fetchAllKeyed in core/
lib/ Drupal/ Core/ Database/ StatementWrapper.php - Returns the entire result set as a single associative array.
- StatementWrapperIterator::fetchAllKeyed in core/
lib/ Drupal/ Core/ Database/ StatementWrapperIterator.php - Returns the entire result set as a single associative array.
File
-
core/
lib/ Drupal/ Core/ Database/ StatementInterface.php, line 194
Class
- StatementInterface
- Represents a prepared statement.
Namespace
Drupal\Core\DatabaseCode
public function fetchAllKeyed($key_index = 0, $value_index = 1);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.