diff --git a/src/Client.php b/src/Client.php index 43f27441..3c79108d 100644 --- a/src/Client.php +++ b/src/Client.php @@ -61,14 +61,14 @@ public function run($query, $parameters = null, $tag = null, $connectionAlias = $connection = $this->connectionManager->getConnection($connectionAlias); $params = null !== $parameters ? $parameters : []; $statement = Statement::create($query, $params, $tag); - $this->eventDispatcher->dispatch(Neo4jClientEvents::NEO4J_PRE_RUN, new PreRunEvent([$statement])); + $this->eventDispatcher->dispatch(new PreRunEvent([$statement]), Neo4jClientEvents::NEO4J_PRE_RUN); try { $result = $connection->run($query, $parameters, $tag); - $this->eventDispatcher->dispatch(Neo4jClientEvents::NEO4J_POST_RUN, new PostRunEvent(ResultCollection::withResult($result))); + $this->eventDispatcher->dispatch(new PostRunEvent(ResultCollection::withResult($result)), Neo4jClientEvents::NEO4J_POST_RUN); } catch (Neo4jException $e) { $event = new FailureEvent($e); - $this->eventDispatcher->dispatch(Neo4jClientEvents::NEO4J_ON_FAILURE, $event); + $this->eventDispatcher->dispatch($event, Neo4jClientEvents::NEO4J_ON_FAILURE); if ($event->shouldThrowException()) { throw $e; diff --git a/src/Transaction/Transaction.php b/src/Transaction/Transaction.php index 27483fe2..dc4c0007 100644 --- a/src/Transaction/Transaction.php +++ b/src/Transaction/Transaction.php @@ -78,16 +78,16 @@ public function run($statement, array $parameters = [], $tag = null) $this->driverTransaction->begin(); } $stmt = Statement::create($statement, $parameters, $tag); - $this->eventDispatcher->dispatch(Neo4jClientEvents::NEO4J_PRE_RUN, new PreRunEvent([$stmt])); + $this->eventDispatcher->dispatch(new PreRunEvent([$stmt]), Neo4jClientEvents::NEO4J_PRE_RUN); try { $result = $this->driverTransaction->run(Statement::create($statement, $parameters, $tag)); - $this->eventDispatcher->dispatch(Neo4jClientEvents::NEO4J_POST_RUN, new PostRunEvent(ResultCollection::withResult($result))); + $this->eventDispatcher->dispatch(new PostRunEvent(ResultCollection::withResult($result)), Neo4jClientEvents::NEO4J_POST_RUN); } catch (MessageFailureException $e) { $exception = new Neo4jException($e->getMessage()); $exception->setNeo4jStatusCode($e->getStatusCode()); $event = new FailureEvent($exception); - $this->eventDispatcher->dispatch(Neo4jClientEvents::NEO4J_ON_FAILURE, $event); + $this->eventDispatcher->dispatch($event, Neo4jClientEvents::NEO4J_ON_FAILURE); if ($event->shouldThrowException()) { throw $exception; }