Updated default field resolver code in documentation.

Updated code to match definition in GraphQL\Executor\Executor::defaultFieldResolver. Change is notable because previous version did not indicate that the closure receives the $info variable.
This commit is contained in:
David B. Nagle 2018-10-10 20:01:12 -07:00
parent 5fb970b3f1
commit e32bbb726d

View File

@ -118,7 +118,7 @@ function defaultFieldResolver($source, $args, $context, \GraphQL\Type\Definition
}
}
return $property instanceof \Closure ? $property($source, $args, $context) : $property;
return $property instanceof Closure ? $property($source, $args, $context, $info) : $property;
}
```
@ -270,4 +270,4 @@ Where **$promiseAdapter** is an instance of:
* Other platforms: write your own class implementing interface: <br>
[`GraphQL\Executor\Promise\PromiseAdapter`](reference.md#graphqlexecutorpromisepromiseadapter).
Then your **resolve** functions should return promises of your platform instead of `GraphQL\Deferred`s.
Then your **resolve** functions should return promises of your platform instead of `GraphQL\Deferred`s.