X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fpq%2FQuery%2FAsyncExecutor.php;fp=lib%2Fpq%2FQuery%2FAsyncExecutor.php;h=a61f87a868cca08df0729562ba35cd43a29ad6b3;hb=c05be811151dbbd5a9b35e886db081bee8338581;hp=a309ce62799cf535810870868b1dc38d10459834;hpb=5acefb4aa883da15d9d1250e680b7fef8f25889a;p=m6w6%2Fpq-gateway
diff --git a/lib/pq/Query/AsyncExecutor.php b/lib/pq/Query/AsyncExecutor.php
index a309ce6..a61f87a 100644
--- a/lib/pq/Query/AsyncExecutor.php
+++ b/lib/pq/Query/AsyncExecutor.php
@@ -33,7 +33,7 @@ class AsyncExecutor extends Executor
*
* Example with reactphp:
*
- * use \React\Promise\Deferred;
+ * use React\Promise\Deferred;
*
* $exec = new pq\Query\AsyncExecutor(new pq\Connection);
* $exec->setCallbacks(
@@ -43,33 +43,32 @@ class AsyncExecutor extends Executor
* },
* # done
* function(Deferred $context, $result) {
- * $context->resolver()->resolve($result);
+ * $context->resolve($result);
* },
* # then
* function(Deferred $context, callable $cb) {
- * return $context->then($cb);
+ * return $context->promise()->then($cb);
* });
* $exec->execute($queryWriter, function($result){});
*
*
* Example with amphp:
*
- * use Amp\Future;
- * use function Amp\reactor;
+ * use Amp\Deferred;
*
* $exec = new pq\Query\AsyncExecutor(new pq\Connection);
* $exec->setCallbacks(
* # init context
* function() {
- * return new Future(reactor());
+ * return new Deferred;
* },
* # done
- * function(Future $context, $result) {
+ * function(Deferred $context, $result) {
* $context->succeed($result);
* },
* # then
- * function(Future $context, callable $cb) {
- * return $context->when(function ($error, $result) use ($cb) {
+ * function(Deferred $context, callable $cb) {
+ * return $context->promise()->when(function($error, $result) use ($cb) {
* $cb($result);
* });
* });
@@ -127,6 +126,7 @@ class AsyncExecutor extends Executor
function(\pq\Result $result) {
$this->result = $result;
$this->notify();
+ return $result;
}, $callback);
$this->getConnection()->execParamsAsync($query, $query->getParams(),
$query->getTypes(), $resolver);