function DatabaseStatementBase::fetchAllAssoc
Overrides DatabaseStatementInterface::fetchAllAssoc
File
-
includes/
database/ database.inc, line 2302
Class
- DatabaseStatementBase
- Default implementation of DatabaseStatementInterface.
Code
public function fetchAllAssoc($key, $fetch = NULL) {
$return = array();
if (isset($fetch)) {
if (is_string($fetch)) {
$this->setFetchMode(PDO::FETCH_CLASS, $fetch);
}
else {
$this->setFetchMode($fetch);
}
}
foreach ($this as $record) {
$record_key = is_object($record) ? $record->{$key} : $record[$key];
$return[$record_key] = $record;
}
return $return;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.