API Platform: OrderFilter reference
27 June 2022 (Updated 7 July 2022)
In a nutshell
API Platform provides the OrderFilter
class to let you order your collections by specific properties.
The syntax is:
Enable ordering on specific properties
Now, you can order the /offers
endpoint with a request like:
Filters aren’t applied unless you pass the order
query param or you specify a default sort order (via the order
attribute to the ApiResource
annotation).
Filter on nested properties
Use the dot syntax to configure the ordering on a nested property:
Now, you can do something like:
Configure custom query param name
By default, you use the order
query param, but you can change this:
Sources
Tagged:
API Platform
Thanks for your comment . Once it's approved, it will appear here.
Leave a comment