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

[RFC] add a new method to retrieve parameters #306

Closed
garak opened this issue Feb 12, 2022 · 1 comment
Closed

[RFC] add a new method to retrieve parameters #306

garak opened this issue Feb 12, 2022 · 1 comment
Labels
RFC RFC = Request For Comments (proposals about features that you want to be discussed)

Comments

@garak
Copy link
Collaborator

garak commented Feb 12, 2022

Our current implementation is relying on Symfony Request object to retrieve parameters (for sorting and/or filtering). Basically, we simply use $request->query for an almost-direct access to query string parameters (being $request->query basically a wrapper around $_GET).
The main problem of this direct approach is that it's impossible for the developer to add a custom layer, so in the end the variables are exposed to end-users (think, for example, to database field names). See for example KnpLabs/KnpPaginatorBundle#728

My idea is to add an interface to abstract parameter retrieving, and inject it everywhere we inject the Request object, as an optional second argument. An internal implementation of such interface can rely on Request object, being super simple.

In an eventual release, we can deprecate the direct using of Request, making the first argument nullable.

Eventually, in a major release, we'll drop the Request injection and rely only on the new interface.

What do you think?

@polc @julienmiclo @pyatnitsev @ThauEx @javer

@garak garak added the RFC RFC = Request For Comments (proposals about features that you want to be discussed) label Feb 12, 2022
@garak
Copy link
Collaborator Author

garak commented Sep 8, 2023

Closing since it was implemented in v4

@garak garak closed this as completed Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC RFC = Request For Comments (proposals about features that you want to be discussed)
Projects
None yet
Development

No branches or pull requests

1 participant