Skip to content

Easing the use of your own EntityRepository as a user provider #11157

@weaverryan

Description

@weaverryan

(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)Doctrine

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy