function UserStorage::doSaveFieldItems
Same name in other branches
- 9 core/modules/user/src/UserStorage.php \Drupal\user\UserStorage::doSaveFieldItems()
- 10 core/modules/user/src/UserStorage.php \Drupal\user\UserStorage::doSaveFieldItems()
- 11.x core/modules/user/src/UserStorage.php \Drupal\user\UserStorage::doSaveFieldItems()
Overrides SqlContentEntityStorage::doSaveFieldItems
File
-
core/
modules/ user/ src/ UserStorage.php, line 20
Class
- UserStorage
- Controller class for users.
Namespace
Drupal\userCode
protected function doSaveFieldItems(ContentEntityInterface $entity, array $names = []) {
// The anonymous user account is saved with the fixed user ID of 0.
// Therefore we need to check for NULL explicitly.
if ($entity->id() === NULL) {
$entity->uid->value = $this->database
->nextId($this->database
->query('SELECT MAX(uid) FROM {' . $this->getBaseTable() . '}')
->fetchField());
$entity->enforceIsNew();
}
return parent::doSaveFieldItems($entity, $names);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.