Guest User

Untitled

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