public static withResult ( GraphAware\Common\Result\RecordCursorInterface $result ) : |
||
$result | GraphAware\Common\Result\RecordCursorInterface | |
return |
/** * Run a Cypher statement against the default database or the database specified. * * @param $query * @param null|array $parameters * @param null|string $tag * @param null|string $connectionAlias * * @return \GraphAware\Common\Result\Result|null * * @throws \GraphAware\Neo4j\Client\Exception\Neo4jExceptionInterface */ public function run($query, $parameters = null, $tag = null, $connectionAlias = null) { $connection = $this->connectionManager->getConnection($connectionAlias); $params = null !== $parameters ? $parameters : array(); $statement = Statement::create($query, $params, $tag); $this->eventDispatcher->dispatch(Neo4jClientEvents::NEO4J_PRE_RUN, new PreRunEvent(array($statement))); try { $result = $connection->run($query, $parameters, $tag); $this->eventDispatcher->dispatch(Neo4jClientEvents::NEO4J_POST_RUN, new PostRunEvent(ResultCollection::withResult($result))); } catch (Neo4jException $e) { $event = new FailureEvent($e); $this->eventDispatcher->dispatch(Neo4jClientEvents::NEO4J_ON_FAILURE, $event); if ($event->shouldThrowException()) { throw $e; } return; } return $result; }