Skip to content
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

[Guard] Improve clarity using the configured provider #6931

Merged
merged 1 commit into from
Sep 21, 2016

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Aug 29, 2016

Recently at work, a colleague trying to discover Guard said me how he was confused by the given example:

Does Guard require to configure an user provider, or can I simply inject the entity manager? Otherwise, what is the point of configuring this provider?

I think I understand why this example was made as is, showing the flexibility of Guard and its ability to answer different needs in different authentication ways without going deeper into things that are already documented somewhere else.
On the other hand I can understand it's confusing and IMHO remove the use of the entity manager can make it clearer and easier to understand.

Note that the current example shouldn't work as is, as don't set the property key of an entity provider involves to create a doctrine repository implementing UserLoaderInterface for the corresponding User entity (if the provider comes to be used of course).

What do you think?

ping @weaverryan

@wouterj
Copy link
Member

wouterj commented Aug 30, 2016

Nice feedback, I agree with you: 👍

@xabbuh
Copy link
Member

xabbuh commented Sep 21, 2016

Thank you @chalasr.

@xabbuh xabbuh merged commit 456dc05 into symfony:2.8 Sep 21, 2016
xabbuh added a commit that referenced this pull request Sep 21, 2016
…alasr)

This PR was merged into the 2.8 branch.

Discussion
----------

[Guard] Improve clarity using the configured provider

Recently at work, a colleague trying to discover Guard said me how it was confused by the given example:

> Does Guard require to configure an user provider, or can I simply inject the entity manager? Otherwise, what is the point of configuring this provider?

I think I understand why this example was made as is, showing the flexibility of Guard and its ability to answer different needs in different authentication ways without going deeper into things that are already documented somewhere else.
On the other hand I can understand it's confusing and IMHO remove the use of the entity manager can make it clearer and easier to understand.

Note that the current example shouldn't work as is, as don't set the `property` key of an entity provider involves to create a doctrine repository implementing `UserLoaderInterface` for the corresponding `User` entity (if the provider comes to be used of course).

What do you think?

ping @weaverryan

Commits
-------

456dc05 [Guard] Improve clarity using the configured provider
@chalasr chalasr deleted the enhance_guard branch September 21, 2016 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants