Guest User

Untitled

a guest
Aug 29th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. Symfony2: Auth using Doctrine2 entity - password set to blank value after saving an entity
  2. security:
  3. encoders:
  4. ISELoginBundleEntityUser:
  5. algorithm: sha1
  6. iterations: 1
  7. encode_as_base64: false
  8. providers:
  9. main:
  10. entity:
  11. class: ISELoginBundleEntityUser
  12. property: username
  13.  
  14. class User implements UserInterface {
  15. // ...
  16. public function eraseCredentials() {
  17. $this->password = null;
  18. $this->salt = null;
  19. }
  20. // ...
  21. }
  22.  
  23. public function createAction() {
  24. // ...
  25. if ($form->isValid()) {
  26. $em = $this->get('doctrine')->getEntityManager();
  27. $em->persist($product);
  28. $em->flush();
  29. return $this->redirect($this->generateUrl('product_create', array('created' => true)));
  30. }
  31. // ...
  32. }
Add Comment
Please, Sign In to add comment