Skip to content
Snippets Groups Projects
Commit ca4a7b82 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2370801 by chx: Fixed Deleting nothing from K-V DB is broken.

parent 1d8f7c54
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -150,13 +150,12 @@ public function rename($key, $new_key) {
*/
public function deleteMultiple(array $keys) {
// Delete in chunks when a large array is passed.
do {
while ($keys) {
$this->connection->delete($this->table)
->condition('name', array_splice($keys, 0, 1000))
->condition('collection', $this->collection)
->execute();
}
while (count($keys));
}
/**
......
......@@ -121,6 +121,8 @@ public function testCRUD() {
$this->assertFalse($stores[0]->get('foo'));
$this->assertFalse($stores[0]->get('bar'));
$this->assertFalse($stores[0]->getMultiple(array('foo', 'bar')));
// Verify that deleting no items does not cause an error.
$stores[0]->deleteMultiple(array());
// Verify that the item in the other collection still exists.
$this->assertIdenticalObject($this->objects[5], $stores[1]->get('foo'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment