GraphAware\Neo4j\Client\Client::runStack PHP Method

runStack() public method

public runStack ( GraphAware\Neo4j\Client\StackInterface $stack ) : ResultCollection | null
$stack GraphAware\Neo4j\Client\StackInterface
return GraphAware\Neo4j\Client\Result\ResultCollection | null
    public function runStack(StackInterface $stack)
    {
        $pipeline = $this->pipeline(null, null, $stack->getTag(), $stack->getConnectionAlias());
        foreach ($stack->statements() as $statement) {
            $pipeline->push($statement->text(), $statement->parameters(), $statement->getTag());
        }
        $this->eventDispatcher->dispatch(Neo4jClientEvents::NEO4J_PRE_RUN, new PreRunEvent($stack->statements()));
        try {
            $results = $pipeline->run();
            $this->eventDispatcher->dispatch(Neo4jClientEvents::NEO4J_POST_RUN, new PostRunEvent($results));
        } catch (Neo4jException $e) {
            $event = new FailureEvent($e);
            $this->eventDispatcher->dispatch(Neo4jClientEvents::NEO4J_ON_FAILURE, $event);
            if ($event->shouldThrowException()) {
                throw $e;
            }
            return;
        }
        return $results;
    }