function UserData::set
Same name in other branches
- 9 core/modules/user/src/UserData.php \Drupal\user\UserData::set()
- 10 core/modules/user/src/UserData.php \Drupal\user\UserData::set()
- 11.x core/modules/user/src/UserData.php \Drupal\user\UserData::set()
Overrides UserDataInterface::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.