Skip to content

Commit 351e5ee

Browse files
committed
Added updates to README missing after recent version bump
1 parent 08b96c5 commit 351e5ee

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Option | Type | Notes
186186
name | `string` | Required. Unique name of this interface type within Schema
187187
fields | `array` | Required. List of fields required to be defined by interface implementors. See [Fields](#fields) section for available options.
188188
description | `string` | Textual description of this interface for clients
189-
resolveType | `callback(value) => objectType` | Any `callable` that receives data from data layer of your application and returns concrete interface implementor for that data.
189+
resolveType | `callback($value, $context, ResolveInfo $info) => objectType` | Any `callable` that receives data from data layer of your application and returns concrete interface implementor for that data.
190190

191191

192192
**Notes**:
@@ -254,7 +254,7 @@ name | `string` | Required. Unique name of this object type within Schema
254254
fields | `array` | Required. List of fields describing object properties. See [Fields](#Fields) section for available options.
255255
description | `string` | Textual description of this type for clients
256256
interfaces | `array` or `callback() => ObjectType[]` | List of interfaces implemented by this type (or callback returning list of interfaces)
257-
isTypeOf | `callback($value, GraphQL\Type\Definition\ResolveInfo $info)` | Callback that takes `$value` provided by your data layer and returns true if that `$value` qualifies for this type
257+
isTypeOf | `callback($value, $context, GraphQL\Type\Definition\ResolveInfo $info)` | Callback that takes `$value` provided by your data layer and returns true if that `$value` qualifies for this type
258258

259259
**Notes:**
260260

@@ -263,7 +263,7 @@ isTypeOf | `callback($value, GraphQL\Type\Definition\ResolveInfo $info)` | Callb
263263
2. Object types are responsible for data fetching. Each of their fields may have optional `resolve` callback option. This callback takes `$value` that corresponds to instance of this type and returns `data` accepted by type of given field.
264264
If `resolve` option is not set, GraphQL will try to get `data` from `$value[$fieldName]`.
265265

266-
3. `resolve` callback is a place where you can use your existing data fetching logic.
266+
3. `resolve` callback is a place where you can use your existing data fetching logic. `$context` is defined by your application on the top level of query execution (useful for storing current user, environment details, etc)
267267

268268
4. Other `ObjectType` mentioned in examples is `Droid`. Check out tests for this type: https://github.com/webonyx/graphql-php/blob/master/tests/StarWarsSchema.php
269269

@@ -282,7 +282,7 @@ Option | Type | Notes
282282
name | `string` | Required. Name of the field. If not set - GraphQL will look use `key` of fields array on type definition.
283283
type | `Type` or `callback() => Type` | Required. One of internal or custom types. Alternatively - callback that returns `type`.
284284
args | `array` | Array of possible type arguments. Each entry is expected to be an array with following keys: **name** (`string`), **type** (`Type` or `callback() => Type`), **defaultValue** (`any`)
285-
resolve | `callback($value, $args, ResolveInfo $info) => $fieldValue` | Function that receives `$value` of parent type and returns value for this field.
285+
resolve | `callback($value, $args, $context, ResolveInfo $info) => $fieldValue` | Function that receives `$value` of parent type and returns value for this field. `$context` is also defined by your application in the root call to `GraphQL::execute()`
286286
description | `string` | Field description for clients
287287
deprecationReason | `string` | Text describing why this field is deprecated. When not empty - field will not be returned by introspection queries (unless forced)
288288

@@ -461,7 +461,7 @@ try {
461461
$schema,
462462
$requestString,
463463
/* $rootValue */ null,
464-
/* $context */ null, // A custom context that can be used to pass current User object etc to resolvers.
464+
/* $context */ null, // A custom context that can be used to pass current User object etc to all resolvers.
465465
$variableValues,
466466
$operationName
467467
);

0 commit comments

Comments
 (0)