Doc Posted January 30, 2017 Share Posted January 30, 2017 Hi, When I'm registering a user : $u = new User(); $u->name = $username; $u->pass = $password; $u->addRole("guest"); $u->save(); ... is there a way to tell that the user was correctly saved ? Can I merely check with : if ($user->id) // OK else // KO I'm asking that because when I'm registering a new user, I'm also saving that $user->id in another table. So I'm wondering is there any clean way to check that, otherwise I'll use a basic check on the existence of $user->id. Thanks Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 31, 2017 Share Posted January 31, 2017 $u->save() should return false (instead of an user object) if there were any issues while saving the user. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now