2

Every time I call EntityManager::flush in any controller action to save any object, the ORM magic tries to also persist the user object from the currently logged in user if I had used any kind of Symfony security before. This object does not have any credentials stored because Symfony correctly called User::eraseCredentials. Do I have to remove the User manually from the EntityManager or do I miss some magic property in the Entity?

David P.
  • 370
  • 1
  • 13
  • 1
    No magic required. Something in your request flow is trying to update the user object. Check to see if any of your setters are being called. – Cerad Mar 20 '20 at 13:50
  • I think you pointing me in the right direction. Indeed there is a ManyToOne pointing to the user object but it has no cascade property. Symfonys eraseCredentilas function is a little bit misleading in the name choice. Thx a lot. https://stackoverflow.com/questions/9150262/symfony2-user-password-set-to-empty-after-running-this-method – David P. Mar 20 '20 at 14:37

0 Answers0