protected UserStorage::doSaveFieldItems(ContentEntityInterface $entity, array $names = [])
Writes entity field values to the storage.
This method is responsible for allocating entity and revision identifiers and updating the entity object with their values.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity object.
string[] $names: (optional) The name of the fields to be written to the storage. If an empty value is passed all field values are saved.
Overrides SqlContentEntityStorage::doSaveFieldItems
File
- core/modules/user/src/UserStorage.php, line 20
Class
- UserStorage
- Controller class for users.
Namespace
Drupal\user
Code
1 2 3 4 5 6 7 8 9 | 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 {users}' )->fetchField()); $entity ->enforceIsNew(); } return parent::doSaveFieldItems( $entity , $names ); } |
Please login to continue.