Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[RFC][HttpKernel][Security] Allowed adding attributes on controller arguments that will be passed to argument resolvers.#37829
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
cd82a16 to59e74d8Compare59e74d8 toc699230Comparec699230 to2484a69Comparefabpot commentedSep 12, 2020
/cc@derrabus |
fabpot left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm going to play with it a little but the code LGTM.
src/Symfony/Component/HttpKernel/Tests/Fixtures/Controller/AttributeController.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…rguments that will be passed to argument resolvers.
2484a69 to20f3169Comparefabpot commentedSep 12, 2020
Thank you@jvasseur. |
src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
derrabus commentedSep 12, 2020
Great addition, thanks@jvasseur! |
Uh oh!
There was an error while loading.Please reload this page.
This PR allow to configure argument resolvers using PHP8 attributes.
This is basically a fix for#29692 but using a different strategy that the one proposed in the issue:
ArgumentMetadataand let the individual resolvers decide if they want to react to the presence of the attribute.Argannotation.As an example, I've added (in the second commit) a
CurrentUserattribute that allows theUserValueResolverto always inject the current user even if the argument is not typed with theUserInterface(to allow typing your actual class instead for example).This would allow to do things like this: