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); } /** * {@inheritdoc} */ protected function isColumnSerial($table_name, $schema_name) { // User storage does not use a serial column for the user id. return $table_name == $this->revisionTable && $schema_name == $this->revisionKey; } /** * {@inheritdoc} */ public function updateLastLoginTimestamp(UserInterface $account) { $this->database->update($this->getDataTable()) ->fields(['login' => $account->getLastLoginTime()]) ->condition('uid', $account->id()) ->execute(); // Ensure that the entity cache is cleared. $this->resetCache([$account->id()]); } /** * {@inheritdoc} */ public function updateLastAccessTimestamp(AccountInterface $account, $timestamp) { $this->database->update($this->getDataTable()) ->fields([ 'access' => $timestamp, ]) ->condition('uid', $account->id()) ->execute(); // Ensure that the entity cache is cleared. $this->resetCache([$account->id()]); } /** * {@inheritdoc} */ public function deleteRoleReferences(array $rids) { // Remove the role from all users. $this->database->delete('user__roles') ->condition('roles_target_id', $rids) ->execute(); $this->resetCache(); } }