function DatabaseStorage::getAll
Same name in other branches
- 8.9.x core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::getAll()
- 10 core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::getAll()
- 11.x core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::getAll()
Overrides KeyValueStoreInterface::getAll
1 method overrides DatabaseStorage::getAll()
- DatabaseStorageExpirable::getAll in core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorageExpirable.php - Returns all stored key/value pairs in the collection.
File
-
core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php, line 101
Class
- DatabaseStorage
- Defines a default key/value store implementation.
Namespace
Drupal\Core\KeyValueStoreCode
public function getAll() {
try {
$result = $this->connection
->query('SELECT [name], [value] FROM {' . $this->connection
->escapeTable($this->table) . '} WHERE [collection] = :collection', [
':collection' => $this->collection,
]);
} catch (\Exception $e) {
$this->catchException($e);
$result = [];
}
$values = [];
foreach ($result as $item) {
if ($item) {
$values[$item->name] = $this->serializer
->decode($item->value);
}
}
return $values;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.