0

I am currently developping a REST API. I need to log all successfull connections in my database. To do that, I've tried to edit my AuthenticationSuccessHandler. But i don't know how to use the entity manager in it. I've read in forums to inject the entity manager in services but a developper didn't advise me that.

I would like to know the best way to resolve my problem.

  • Well, how about you share some code, and what you already tried ? You have to be more specific — this is worth a few minutes read : https://stackoverflow.com/help/how-to-ask – tchap Nov 16 '15 at 09:34
  • Ask the developer why you should not do what appears to be a very common and recommended practice i.e. injecting the entity manager. Of course if you just need to log then maybe you should use the logger functionality. – Cerad Nov 16 '15 at 13:53
  • I would go the way of injecting em to your handler. I'm really not aware of any other way to do what you want. We used it multiple times in our projects, few times directly in the code, few times in yaml file, never had a problem with that. I don't see a reason why not to do that, inject a dependency into code is normal practice. – Michal Takáč Nov 16 '15 at 17:04

0 Answers0