-
-
Notifications
You must be signed in to change notification settings - Fork 844
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
Prefer order filter on canonical field #1171
Comments
You may write a custom filter which extends the |
@teohhanhui Thanks for the reply. I already did that, I was wondering if this something we could add to api-platform/core. |
I don't mind if we implement this feature, it can be useful IMHO. |
@Simperfit Sure ! It's a funny coincidence, I finally upgraded my app last week to use the ApiFilter annotation everywhere and I updated the way my CanonicalOrderFilter works. The resulting syntax is the following:
I will make a PR tonight so you can check it. |
@tseho That's one of my ability, if you are a french people, I can read though your mind just by reading the issue :p. |
Mhh looks to me that this is a specific use case. I don't see a fit in the core though. |
@soyuka It's not really my call :) @Simperfit I have been running more tests and found out that having the CanonicalOrderFilter on a field is against the spirit of OrderFilter because you cannot control the order on which the filters are applied. I think a proper solution would be to add a new option:
The change to OrderFilter could be then something like this:
|
Hey @soyuka, @Simperfit, should I open a PR with my last proposal ? |
probably related to #2090 |
When using the Doctrine ORM OrderFilter, I had a case when I had to sort on a canonical version of a field for valid results. (And, I hope, faster queries with proper indexes)
I created a custom version of OrderFilter, checking if the sorted field has a canonical column (eg: name => name_canonical) and uses it in the orderBy instead of the normal one.
It is something you would accept if I do a PR ?
The text was updated successfully, but these errors were encountered: