Hi all,

I want to override the user_manager service in order to modify the 
findByUsername() method (to add a JOIN when loading users from the 
user_provider).
I've added my own Entity\UserManager in the directory of my bundle which 
inherits from FOSUserBundle, but it doesn't work.

First question: Why Symfony is still using FOS\UserBundle\Entity\UserManager 
instead of my Asso\UserBundle\Entity\UserManager?

Then I investigated and found the declaration of the service user_provider 
: <service id="fos_user.user_manager" class="%fos_user.user_manager.class%">
It uses the fos_user.user_manager.class parameter. If I change this 
parameter manually (in FOS/UserBundle/Resources/config/orm.xml) then my own 
UserManager is used and everything works well. But it's ugly.
The problem is that this parameter can't be defined in the fos_user section 
of my config.yml. Hence my second question: How to insert my own 
implementation of the user_provider without hacking the original bundle?

I could define my UserManager as a service, and use it from my security.yml. 
But I should copy-paste the definition of all the arguments from the 
original user_manager service, and it means problems when updating the 
bundle (what if they change an argument?). I just override a 
single independent function, it's quite annoying to define a brand new 
service just for that. Third question: How to do in that case (which can be 
found in many bundles)? Do I really have to define a new service?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to