function DatabaseStorage::getAllKeys

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::getAllKeys()

Overrides StorageBase::getAllKeys

1 method overrides DatabaseStorage::getAllKeys()
DatabaseStorageExpirable::getAllKeys in core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php
Retrieves all keys in the collection.

File

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

Class

DatabaseStorage
Defines a default key/value store implementation.

Namespace

Drupal\Core\KeyValueStore

Code

public function getAllKeys() : iterable {
  try {
    $values = $this->connection
      ->query('SELECT [name] FROM {' . $this->connection
      ->escapeTable($this->table) . '} WHERE [collection] = :collection', [
      ':collection' => $this->collection,
    ])
      ->fetchCol();
    return $values;
  } catch (\Exception $e) {
    $this->catchException($e);
  }
  return [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.