Issue #3416525 by smustgrave, cmlara, NikolaAt, alexpott: DatabaseStorage, readMultiple throws error when receive empty array
parent
b8aa161ca0
commit
a52980995a
|
@ -105,6 +105,10 @@ class DatabaseStorage implements StorageInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function readMultiple(array $names) {
|
||||
if (empty($names)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$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();
|
||||
|
|
|
@ -44,6 +44,9 @@ abstract class ConfigStorageTestBase extends KernelTestBase {
|
|||
// Checking whether readMultiple() works with empty storage.
|
||||
$this->assertEmpty($this->storage->readMultiple([$name]));
|
||||
|
||||
// readMultiple() accepts an empty array.
|
||||
$this->assertSame([], $this->storage->readMultiple([]), 'Empty query should return empty array');
|
||||
|
||||
// Reading a non-existing name returns FALSE.
|
||||
$data = $this->storage->read($name);
|
||||
$this->assertFalse($data);
|
||||
|
|
Loading…
Reference in New Issue