security-context-token

Symfony2 - Inject the currently logged in user into a listener

隐身守侯 提交于 2020-01-01 08:58:07
问题 I am trying to inject the currently logged in user into a Listener. My goal is to write a current \DateTime() to the 'last_active' column of my 'demo_user' table every time the user does any action (both of this this methods do not work for me) . app/config/config.yml # ... services: demo.listener: class: Demo\UserBundle\EventListener\ActivityWatcher.php arguments: ['@service_container'] tags: - { name: doctrine.event_listener, event: postLoad } src/Demo/UserBundle/EventListener