Skip to content

Commit 9bf9e7d

Browse files
committed
docs: update docs
1 parent a2c36f1 commit 9bf9e7d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

docs/customization/user_provider.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,16 @@ class UserModel extends ShieldUserModel
5555
}
5656
```
5757

58-
## Using a Custom User Entity
58+
## Creating a Custom User Entity
5959

60-
If you have set a custom `$returnType` in your custom `UserModel`, you may
61-
retrieve the return type using the `UserModel::getReturnType()` method and
62-
easily create a new User Entity using it:
60+
Starting from v1.2.0, `UserModel` in Shield has the `createNewUser()` method to
61+
create a new User Entity.
6362

6463
```php
65-
$userEntityClass = $userModel->getReturnType();
66-
$newUser = new $userEntityClass();
64+
$user = $userModel->createNewUser($data);
6765
```
66+
67+
It takes an optional user data array as the first argument, and passes it to the
68+
constructor of the `$returnType` class.
69+
70+
If your custom User entity cannot be instantiated in this way, override this method.

0 commit comments

Comments
 (0)