The entity index resources are great, but have some limitations (and hard codings) that could easily be overcome. Example limitations:
- #2165347: Use custom orderBy on Taxonomy Vocabulary Index
- #2403645: Add Support for Custom Query Conditions on Entity Index Resources - I've provided a potential work around here
Since the latter has received positive impact, and I now see an opportunity to abstract the proposed solution even further to support other query options, I'd like to take this a step further. For example being able to apply an orderBy to an index query would be very handy as well.
Here's a proposed example URL query string demonstrating the combination of efforts into a new query string parameter for entity index resources called options:
# excluding encoded uri components
?q=endpoint/taxonomy_term.json&fields=tid,name¶meters[name]=%foo%&options[parameters_op][name]=like&options[orderby][name]=asc
As you can see this would allow as to apply custom operators on the filter (e.g. like, in, =, >, <, etc), and also specify a custom order by on column names (asc, desc). This would greatly increase the flexibility of the entity index resources.
I'd like to see this applied for all core entity types, and am happy to fully implement this. If endorsed, this would deprecate both of the related issues in favor of this issue.
Patch to come (taxonomy term index only, for starters)...
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | index_query_options-2537968-1.patch | 3.61 KB | tyler.frankenstein |
Comments
Comment #1
tyler.frankenstein commentedComment #2
tyler.frankenstein commentedComment #4
kylebrowning commentedComment #5
tyler.frankenstein commentedRe-opening as I need to add this across all other core entity types (the current patch is taxonomy terms only).
Comment #6
tyler.frankenstein commentedComment #8
kylebrowning commented