X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fpq-gateway;a=blobdiff_plain;f=lib%2Fpq%2FQuery%2FAsyncExecutor.php;fp=lib%2Fpq%2FQuery%2FAsyncExecutor.php;h=4b58a995e7ad942fe73fee0d4c7621e845e773df;hp=a61f87a868cca08df0729562ba35cd43a29ad6b3;hb=5c080bb03b5fee867da94cb3c1108d59529f741a;hpb=0a6fac6b260383a6abea76804410273c7b8b630b diff --git a/lib/pq/Query/AsyncExecutor.php b/lib/pq/Query/AsyncExecutor.php index a61f87a..4b58a99 100644 --- a/lib/pq/Query/AsyncExecutor.php +++ b/lib/pq/Query/AsyncExecutor.php @@ -103,7 +103,9 @@ class AsyncExecutor extends Executor $context = $init(); foreach (func_get_args() as $cb) { - $then($context, $cb); + if (is_callable($callback)) { + $then($context, $cb); + } } return array($context, function($result) use ($context, $done) { @@ -117,7 +119,7 @@ class AsyncExecutor extends Executor * @param callable $callback result callback * @return mixed context created by the init callback */ - function execute(WriterInterface $query, callable $callback) { + function execute(WriterInterface $query, callable $callback = null) { $this->result = null; $this->query = $query; $this->notify();