Hello. I have a little problem. I have login form which work really nice. I want to save the last login date of the user. How can I do this thing. I was thinking that I can put this function in SecuredController in public function securityCheckAction() {} but it doesn`t work

And for my suprise If I delete this Action I can login without any problem

I wrote this function
- Code: Select all
$em = $this->getDoctrine()->getEntityManager();
$user = $this->get('security.context')->getToken()->getUser();
$user->setUserLastLogin(new \Datetime('now'));
$em->persist($user);
$em->flush();
But I don`t know where to write it

Any suggestion?