function UserData::set
Same name in other branches
- 9 core/modules/user/src/UserData.php \Drupal\user\UserData::set()
- 8.9.x core/modules/user/src/UserData.php \Drupal\user\UserData::set()
- 10 core/modules/user/src/UserData.php \Drupal\user\UserData::set()
File
-
core/
modules/ user/ src/ UserData.php, line 76
Class
- UserData
- Defines the user data service.
Namespace
Drupal\userCode
public function set($module, $uid, $name, $value) {
$serialized = (int) (!is_scalar($value));
if ($serialized) {
$value = serialize($value);
}
$this->connection
->merge('users_data')
->keys([
'uid' => $uid,
'module' => $module,
'name' => $name,
])
->fields([
'value' => $value,
'serialized' => $serialized,
])
->execute();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.