function DatabaseStorage::doSet
Same name in other branches
- 9 core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::doSet()
- 11.x core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::doSet()
Saves a value for a given key.
This will be called by set() within a try block.
Parameters
string $key: The key of the data to store.
mixed $value: The data to store.
1 call to DatabaseStorage::doSet()
- DatabaseStorage::set in core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php - Saves a value for a given key.
File
-
core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php, line 129
Class
- DatabaseStorage
- Defines a default key/value store implementation.
Namespace
Drupal\Core\KeyValueStoreCode
protected function doSet($key, $value) {
$this->connection
->merge($this->table)
->keys([
'name' => $key,
'collection' => $this->collection,
])
->fields([
'value' => $this->serializer
->encode($value),
])
->execute();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.