Merge branch 'master' of https://github.com/webonyx/graphql-php into v0.10

This commit is contained in:
Vladimir Razuvaev 2017-08-20 23:16:51 +07:00
commit 6fdcfd9bb0
2 changed files with 21 additions and 1 deletions

View File

@ -237,7 +237,7 @@ resolveType | `callback($value, $context, ResolveInfo $info) => objectType` | An
**Notes**:
1. If `resolveType` option is omitted, GraphQL PHP will loop through all interface implementors and use their `isTypeOf()` method to pick the first suitable one. This is obviously less efficient than single `resolveType` call. So it is recommended to define `resolveType` when possible.
1. If `resolveType` option is omitted, GraphQL PHP will loop through all interface implementers and use their `isTypeOf()` method to pick the first suitable one. This is obviously less efficient than single `resolveType` call. So it is recommended to define `resolveType` when possible.
2. Interface types do not participate in data fetching. They just resolve actual `object` type which will be asked for data when GraphQL query is executed.

View File

@ -128,6 +128,7 @@ class SyncPromiseAdapter implements PromiseAdapter
*/
public function wait(Promise $promise)
{
$this->beforeWait($promise);
$dfdQueue = Deferred::getQueue();
$promiseQueue = SyncPromise::getQueue();
@ -137,6 +138,7 @@ class SyncPromiseAdapter implements PromiseAdapter
) {
Deferred::runQueue();
SyncPromise::runQueue();
$this->onWait($promise);
}
/** @var SyncPromise $syncPromise */
@ -150,4 +152,22 @@ class SyncPromiseAdapter implements PromiseAdapter
throw new InvariantViolation("Could not resolve promise");
}
/**
* Execute just before starting to run promise completion
*
* @param Promise $promise
*/
protected function beforeWait(Promise $promise)
{
}
/**
* Execute while running promise completion
*
* @param Promise $promise
*/
protected function onWait(Promise $promise)
{
}
}