Symfony EventListner to write somethigng to database

I am now stepping into Symfony’s EventListener and below are the code snippets:

// service.yaml
    - {name: kernel.event_listener, event: security.interactive_login, method: onInteractiveLogin}
class AuthenticationListener {
  public function onInteractiveLogin(InteractiveLoginEvent $e) {

These codes worked well and got triggered properly. Now, I want to add some code in that onInteractiveLogin function so that it can update the user (an AppEnityUser entity) so that its last_login field (this field is in the user table) gets updated.

Please throw in some hints. Thanks.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *