-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
(this issue is part of the "DX" ("Developer eXperience") initiative introduced by Symfony project)
Suppose I want to use the entity provider, but I want to make it use my repository, so that I can load my User object via some other method (e.g. by username OR email). We talk about this here: http://symfony.com/doc/current/cookbook/security/entity_provider.html#authenticating-someone-with-a-custom-entity-provider
I do this because I want to override loadUserByUsername, but this forces me to also copy in logic for refreshUser and supportsClass, even though I certainly don't care about these. In fact, EntityUserProvider checks for UserProviderInterface only to call loadUserByUsername or refreshUser (but supportsClass is never called).
Could we add a new interface here with only the loadUserByUsername method - e.g. EntityUserProvider? Or perhaps, have a UserProviderEntityRepository base class that extends EntityProvider but contains the logic for these 3 methods? The end goal: allow me to control how my User is loaded, but don't force me to do anything else.