File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments