DatabaseStorage::getAll

public DatabaseStorage::getAll()

Returns all stored key/value pairs in the collection.

Return value

array An associative array containing all stored items in the collection.

Overrides KeyValueStoreInterface::getAll

File

core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php, line 94

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;
}
doc_Drupal
2016-10-29 08:59:56
Comments
Leave a Comment

Please login to continue.