You are here

public function DatabaseStorage::getAllCollectionNames in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::getAllCollectionNames()

Gets the existing collections.

A configuration storage can contain multiple sets of configuration objects in partitioned collections. The collection key name identifies the current collection used.

Return value

array An array of existing collection names.

Overrides StorageInterface::getAllCollectionNames

File

core/lib/Drupal/Core/Config/DatabaseStorage.php, line 319

Class

DatabaseStorage
Defines the Database storage.

Namespace

Drupal\Core\Config

Code

public function getAllCollectionNames() {
  try {
    return $this->connection
      ->query('SELECT DISTINCT collection FROM {' . $this->connection
      ->escapeTable($this->table) . '} WHERE collection <> :collection ORDER by collection', [
      ':collection' => StorageInterface::DEFAULT_COLLECTION,
    ])
      ->fetchCol();
  } catch (\Exception $e) {
    return [];
  }
}