From 7afd6d3f9abc21a4f658818f93cd88d882e451a9 Mon Sep 17 00:00:00 2001 From: Zeeshan Ahmed Date: Fri, 28 Jul 2017 11:24:15 +0500 Subject: [PATCH 1/3] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a1cc75e..817f8c6 100644 --- a/README.md +++ b/README.md @@ -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. From 658816180aa4a07d4cfcc6f075a230a6073506b0 Mon Sep 17 00:00:00 2001 From: Yannick Yeboue Date: Sat, 12 Aug 2017 12:17:13 -0400 Subject: [PATCH 2/3] Update unions.md replace semi colon with a comma as it would cause a syntax error --- docs/type-system/unions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/type-system/unions.md b/docs/type-system/unions.md index 83e2fdb..9b5dcae 100644 --- a/docs/type-system/unions.md +++ b/docs/type-system/unions.md @@ -11,7 +11,7 @@ $searchResultType = new UnionType([ 'types' => [ MyTypes::story(), MyTypes::user() - ]; + ], 'resolveType' => function($value) { if ($value->type === 'story') { return MyTypes::story(); From 1c143360ca5fbb5d72246e37652fa07cc9502f9f Mon Sep 17 00:00:00 2001 From: Jeremiah VALERIE Date: Fri, 18 Aug 2017 16:18:48 +0200 Subject: [PATCH 3/3] Add hooks to helps promise completion with custom backend --- .../Promise/Adapter/SyncPromiseAdapter.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Executor/Promise/Adapter/SyncPromiseAdapter.php b/src/Executor/Promise/Adapter/SyncPromiseAdapter.php index 35341b3..44ddf66 100644 --- a/src/Executor/Promise/Adapter/SyncPromiseAdapter.php +++ b/src/Executor/Promise/Adapter/SyncPromiseAdapter.php @@ -126,6 +126,7 @@ class SyncPromiseAdapter implements PromiseAdapter */ public function wait(Promise $promise) { + $this->beforeWait($promise); $dfdQueue = Deferred::getQueue(); $promiseQueue = SyncPromise::getQueue(); @@ -135,6 +136,7 @@ class SyncPromiseAdapter implements PromiseAdapter ) { Deferred::runQueue(); SyncPromise::runQueue(); + $this->onWait($promise); } /** @var SyncPromise $syncPromise */ @@ -148,4 +150,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) + { + } }