Skip to content

Commit

Permalink
docs: update about UserModel::insert() and update()
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Jul 15, 2022
1 parent 51bb61b commit af13b4c
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ NOTE: The User rows use [soft deletes](https://codeigniter.com/user_guide/models

### Editing A User

The `UserModel::save()` method has been modified to ensure that an email or password previously set on the `User` entity will be automatically updated in the correct `UserIdentity` record.
The `UserModel::save()`, `update()` and `insert()` methods have been modified to ensure that an email or password previously set on the `User` entity will be automatically updated in the correct `UserIdentity` record.

```php
$users = model('UserModel');
Expand All @@ -309,21 +309,3 @@ $user->fill([
]);
$users->save($user);
```

If you prefer to use the `update()` method then you will have to update the user's appropriate UserIdentity manually.

```php
$users = model('UserModel');
$user = $users->findById(123);

$user->fill([
'username' => 'JoeSmith111',
'email' => 'joe.smith@example.com',
'password' => 'secret123'
]);

// Saves the username field
$users->update($user);
// Updates the email and password
$user->saveEmailIdentity();
```

0 comments on commit af13b4c

Please sign in to comment.