public function DatabaseStorageSortedSet::addMultiple in Key-value Extensions 8
Parameters
array $pairs:
Overrides KeyValueStoreSortedSetInterface::addMultiple
1 call to DatabaseStorageSortedSet::addMultiple()
- DatabaseStorageSortedSet::add in src/
KeyValueStore/ DatabaseStorageSortedSet.php
File
- src/
KeyValueStore/ DatabaseStorageSortedSet.php, line 17
Class
Namespace
Drupal\key_value\KeyValueStoreCode
public function addMultiple(array $pairs) {
// @todo Find out if we can to multiple merge queries in one atomic
// operation.
foreach ($pairs as $pair) {
foreach ($pair as $score => $member) {
$encoded_member = $this->serializer
->encode($member);
$this->connection
->merge($this->table)
->fields([
'collection' => $this->collection,
'name' => $score,
'value' => $encoded_member,
])
->condition('collection', $this->collection)
->condition('value', $encoded_member)
->execute();
}
}
}