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

Add alias to filter properties #5856

Closed
tjveldhuizen opened this issue Sep 29, 2023 · 1 comment
Closed

Add alias to filter properties #5856

tjveldhuizen opened this issue Sep 29, 2023 · 1 comment

Comments

@tjveldhuizen
Copy link

Description
API Platform allows to define filters based on properties in a related object. For example: /teams?club.slug=my-club. I don't like the fact that my internal properties need to be exposed in this filters. Maybe it's not that problematic in this case, but when filtering on objects 'further away' it can get messy: /matches?pool.competition.season.id=2023&pool.competition.region.slug=north and I'm exposing more of the data model. It would be really nice to be able to squash that into /matches?season=2023&region=north.

Now, the only solution is to create custom filters, but it might be possible to allow adding an alias to the #[ApiFilter] attribute? However the fact that multiple properties are allowed makes the format of such configuration complicated.

@soyuka
Copy link
Member

soyuka commented Oct 6, 2023

#2400
adds to the list of things to improve... For now just create your own filter? Closing as I want to centralize filter issues to #2400 for a future filter refactoring!

@soyuka soyuka closed this as completed Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants