-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Easing the use of your own EntityRepository as a user provider #11157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
the base class would be a bad idea, because we would have to ship a base class for each of the Doctrine projects (as each of them has its own base repository class). |
Hola, disculpen si me equivoco comentando aquí, pero lo hago porque tiene que ver con la entidad Usuario.. Apenas estoy empezando en symfony2, siguiendo los tutoriales en español, especificamente: http://gitnacho.github.io/symfony-docs-es/book/security.html#security-book-access-control-explanation . el cual me sirvió mucho para hacer el CRUD, entendí como crear rutas, controladores y nuevas páginas, e incluso como subir archivos, pero llegué al punto de seguridad y LOGUEO y de allí no pasé, ya que plantea dos tablas (Entidades: roles y usuarios) y en la aplicación de prueba con la que estaba aprendiendo el framework sólo manejaba una tabla para los usuarios, no comprendí como modificar esto para poder hacer el logueo y hasta allí quedé... Saludos. |
@robinsorg88. Se habla espanol? In English please. |
Hi, sorry if I'm wrong here commenting, but I do it because it has to do with the User entity .. I'm just beginning in Symfony2, following the tutorials in Spanish, specifically: http://gitnacho.github.io/symfony-docs-es/book/security.html#security-book-access-control-explanation . which helped me to do CRUD, understood as creating routes, controllers and new pages, and even how to upload files, but I got to the security checkpoint and logging and there did not pass as it raises two tables (entities: roles and users) and application of test that was learning the framework only managed a table for users, not understood how this change to make the logging and there was ... Greetings. |
@robinsorg88 Hola! I don't think your question is related to this issue. Si tiene alguna pregunta de usar Symfony, puede usar el mailing list: https://groups.google.com/forum/#!forum/Symfony2. Y hay un grupo para espanol tambien! :) https://groups.google.com/forum/#!forum/symfony-es Saludos! |
I'll try to propose a solution for this. |
So my idea for this is to introduce a |
Also as I didn't know if this solution will actually be used I didn't change the comments explaining the use of this interface. If this is accepted I think that the comment in |
…ctrine. (mtrojanowski) This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes #15947). Discussion ---------- Added UserLoaderInterface for loading users through Doctrine. | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #11157 | License | MIT | Doc PR | symfony/symfony-docs#4543 Based on the @weaverryan and @stof propositions from [this](#12733 (comment)) discussion I created a new interface in the Doctrine Bridge which can be used to more easily implement a repository capable of returning a User. Commits ------- a8d3d12 Added UserLoaderInterface for loading users through Doctrine.
(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-providerI do this because I want to override
loadUserByUsername
, but this forces me to also copy in logic forrefreshUser
andsupportsClass
, even though I certainly don't care about these. In fact, EntityUserProvider checks forUserProviderInterface
only to callloadUserByUsername
orrefreshUser
(butsupportsClass
is never called).Could we add a new interface here with only the
loadUserByUsername
method - e.g.EntityUserProvider
? Or perhaps, have aUserProviderEntityRepository
base class that extendsEntityProvider
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.The text was updated successfully, but these errors were encountered: