You are here

public function DatabaseStorage::readMultiple in Drupal 10

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

File

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

Class

DatabaseStorage
Defines the Database storage.

Namespace

Drupal\Core\Config

Code

public function readMultiple(array $names) {
  $list = [];
  try {
    $list = $this->connection
      ->query('SELECT [name], [data] FROM {' . $this->connection
      ->escapeTable($this->table) . '} WHERE [collection] = :collection AND [name] IN ( :names[] )', [
      ':collection' => $this->collection,
      ':names[]' => $names,
    ], $this->options)
      ->fetchAllKeyed();
    foreach ($list as &$data) {
      $data = $this
        ->decode($data);
    }
  } catch (\Exception $e) {

    // If we attempt a read without actually having the database or the table
    // available, just return an empty array so the caller can handle it.
  }
  return $list;
}