Skip to content

Commit 6fdcfd9

Browse files
committed
Merge branch 'master' of https://github.com/webonyx/graphql-php into v0.10
2 parents cbc744e + ed66291 commit 6fdcfd9

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ resolveType | `callback($value, $context, ResolveInfo $info) => objectType` | An
237237

238238
**Notes**:
239239

240-
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.
240+
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.
241241

242242
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.
243243

src/Executor/Promise/Adapter/SyncPromiseAdapter.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ function($value) use ($index, &$count, $total, &$result, $all) {
128128
*/
129129
public function wait(Promise $promise)
130130
{
131+
$this->beforeWait($promise);
131132
$dfdQueue = Deferred::getQueue();
132133
$promiseQueue = SyncPromise::getQueue();
133134

@@ -137,6 +138,7 @@ public function wait(Promise $promise)
137138
) {
138139
Deferred::runQueue();
139140
SyncPromise::runQueue();
141+
$this->onWait($promise);
140142
}
141143

142144
/** @var SyncPromise $syncPromise */
@@ -150,4 +152,22 @@ public function wait(Promise $promise)
150152

151153
throw new InvariantViolation("Could not resolve promise");
152154
}
155+
156+
/**
157+
* Execute just before starting to run promise completion
158+
*
159+
* @param Promise $promise
160+
*/
161+
protected function beforeWait(Promise $promise)
162+
{
163+
}
164+
165+
/**
166+
* Execute while running promise completion
167+
*
168+
* @param Promise $promise
169+
*/
170+
protected function onWait(Promise $promise)
171+
{
172+
}
153173
}

0 commit comments

Comments
 (0)