Exemple #1
0
 /**
  * {@inheritdoc}
  */
 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);
 }