Guest User

Untitled

a guest
Jul 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. //the column "externalUserId" should be unique, but how to do it with doctrine?
  2.  
  3. //when calling this a new user record with externalUserId=4711 will be created
  4. $myUser = new myUser();
  5. $myUser->externalUserId = 4711;
  6. $myUser->save();
  7.  
  8. //when calling this a second user record with externalUserId=4711 will be created
  9. $myUser = new myUser();
  10. $myUser->externalUserId = 4711;
  11. $myUser->save();
  12.  
  13. //the second call should throw an exception "Can not create this user.
  14. //User is already there.
  15. //Please load the user details and change that user if you want to change the user."
Add Comment
Please, Sign In to add comment