In a Symfony2.8/Doctrine2 application, I need to store in each row of my SQL tables the id of the user who created or updated the row (users can connect with Ldap).
You can look at BlameableListener from gedmo/doctrine-extensions package, that work almost the way you want but with the username instead of the user id.