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
+103Lines changed: 103 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,6 +129,8 @@ final class BookCollectionResolver implements QueryCollectionResolverInterface
129
129
*/
130
130
public function __invoke($collection, array $context)
131
131
{
132
+
// Query arguments are in $context['args'].
133
+
132
134
foreach ($collection as $book) {
133
135
// Do something with the book.
134
136
}
@@ -170,6 +172,8 @@ final class BookResolver implements QueryItemResolverInterface
170
172
*/
171
173
public function __invoke($item, array $context)
172
174
{
175
+
// Query arguments are in $context['args'].
176
+
173
177
// Do something with the book.
174
178
// Or fetch the book if it has not been retrieved.
175
179
@@ -235,6 +239,8 @@ Conversely, if you need to add custom arguments, make sure `id` is added among t
235
239
- If you have added your [own custom types](#custom-types), you can use them directly for your arguments types (it's the case here for `DateTime`).
236
240
- You can also add a custom description for your custom arguments. You can see the [field arguments documentation](https://webonyx.github.io/graphql-php/type-system/object-types/#field-arguments) for more options.
237
241
242
+
The arguments you have defined or the default ones and their value will be in `$context['args']` of your resolvers.
0 commit comments