You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/graphql.md
+41-2Lines changed: 41 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -588,7 +588,7 @@ The cache is named `api_platform.graphql.cache.subscription` and the subscriptio
588
588
589
589
It's recommended to use an adapter like Redis for this cache.
590
590
591
-
##Workflow of the Resolvers
591
+
##Workflow of the Resolvers
592
592
593
593
API Platform resolves the queries and mutations by using its own **resolvers**.
594
594
@@ -757,6 +757,45 @@ class Offer
757
757
}
758
758
```
759
759
760
+
### Syntax for Filters with a List of Key / Value Arguments
761
+
762
+
Some filters like the [exists filter](filters.md#exists-filter) or the [order filter](filters.md#order-filter-sorting) take a list of key / value as arguments.
763
+
764
+
The first syntax coming to mind to use them is to write:
765
+
766
+
```graphql
767
+
{
768
+
offers(order: {id: "ASC", name: "DESC"}) {
769
+
edges {
770
+
node {
771
+
id
772
+
name
773
+
}
774
+
}
775
+
}
776
+
}
777
+
```
778
+
779
+
However this syntax has a problematic issue: it doesn't keep the order of the arguments.
780
+
These filters usually need a proper order to give results as expected.
781
+
782
+
That's why this syntax needs to be used instead:
783
+
784
+
```graphql
785
+
{
786
+
offers(order: [{id: "ASC"}, {name: "DESC"}]) {
787
+
edges {
788
+
node {
789
+
id
790
+
name
791
+
}
792
+
}
793
+
}
794
+
}
795
+
```
796
+
797
+
Since a list is used for the arguments, the order is preserved.
798
+
760
799
### Filtering on Nested Properties
761
800
762
801
Unlike for REST, all built-in filters support nested properties using the underscore (`_`) syntax instead of the dot (`.`) syntax, e.g.:
0 commit comments