You are here

public function DatabaseStorage::getAll in Service Container 7.2

Same name and namespace in other branches
  1. 7 lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::getAll()

Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::getAll().

Overrides KeyValueStoreInterface::getAll

1 method overrides DatabaseStorage::getAll()
DatabaseStorageExpirable::getAll in lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php
Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::getAll().

File

lib/Drupal/Core/KeyValueStore/DatabaseStorage.php, line 96
Contains \Drupal\Core\KeyValueStore\DatabaseStorage.

Class

DatabaseStorage
Defines a default key/value store implementation.

Namespace

Drupal\Core\KeyValueStore

Code

public function getAll() {
  $result = $this->connection
    ->query('SELECT name, value FROM {' . $this->connection
    ->escapeTable($this->table) . '} WHERE collection = :collection', array(
    ':collection' => $this->collection,
  ));
  $values = array();
  foreach ($result as $item) {
    if ($item) {
      $values[$item->name] = $this->serializer
        ->decode($item->value);
    }
  }
  return $values;
}