mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-25 06:16:05 +03:00
Merge pull request #507 from spawnia/resolver-arguments-order
Fix misleading comments and docs about resolver arguments: Context is 3rd, ResolveInfo is 4th
This commit is contained in:
commit
ed1d835bd5
@ -299,7 +299,7 @@ static function getNullableType($type)
|
|||||||
```
|
```
|
||||||
# GraphQL\Type\Definition\ResolveInfo
|
# GraphQL\Type\Definition\ResolveInfo
|
||||||
Structure containing information useful for field resolution process.
|
Structure containing information useful for field resolution process.
|
||||||
Passed as 3rd argument to every field resolver. See [docs on field resolving (data fetching)](data-fetching.md).
|
Passed as 4th argument to every field resolver. See [docs on field resolving (data fetching)](data-fetching.md).
|
||||||
|
|
||||||
**Class Props:**
|
**Class Props:**
|
||||||
```php
|
```php
|
||||||
|
@ -526,7 +526,11 @@ class ReferenceExecutor implements ExecutorImplementation
|
|||||||
return self::$UNDEFINED;
|
return self::$UNDEFINED;
|
||||||
}
|
}
|
||||||
$returnType = $fieldDef->getType();
|
$returnType = $fieldDef->getType();
|
||||||
// The resolve function's optional third argument is a collection of
|
// The resolve function's optional 3rd argument is a context value that
|
||||||
|
// is provided to every resolve function within an execution. It is commonly
|
||||||
|
// used to represent an authenticated user, or request-specific caches.
|
||||||
|
$context = $exeContext->contextValue;
|
||||||
|
// The resolve function's optional 4th argument is a collection of
|
||||||
// information about the current execution state.
|
// information about the current execution state.
|
||||||
$info = new ResolveInfo(
|
$info = new ResolveInfo(
|
||||||
$fieldName,
|
$fieldName,
|
||||||
@ -547,10 +551,6 @@ class ReferenceExecutor implements ExecutorImplementation
|
|||||||
} else {
|
} else {
|
||||||
$resolveFn = $this->exeContext->fieldResolver;
|
$resolveFn = $this->exeContext->fieldResolver;
|
||||||
}
|
}
|
||||||
// The resolve function's optional third argument is a context value that
|
|
||||||
// is provided to every resolve function within an execution. It is commonly
|
|
||||||
// used to represent an authenticated user, or request-specific caches.
|
|
||||||
$context = $exeContext->contextValue;
|
|
||||||
// Get the resolve function, regardless of if its result is normal
|
// Get the resolve function, regardless of if its result is normal
|
||||||
// or abrupt (error).
|
// or abrupt (error).
|
||||||
$result = $this->resolveOrError(
|
$result = $this->resolveOrError(
|
||||||
|
@ -15,7 +15,8 @@ use function array_merge_recursive;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Structure containing information useful for field resolution process.
|
* Structure containing information useful for field resolution process.
|
||||||
* Passed as 3rd argument to every field resolver. See [docs on field resolving (data fetching)](data-fetching.md).
|
*
|
||||||
|
* Passed as 4th argument to every field resolver. See [docs on field resolving (data fetching)](data-fetching.md).
|
||||||
*/
|
*/
|
||||||
class ResolveInfo
|
class ResolveInfo
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user