Пример #1
0
 /**
  * @param StackInterface $stack
  *
  * @return mixed
  */
 public function runStack(StackInterface $stack)
 {
     if (!$this->driverTransaction->isOpen() && !in_array($this->driverTransaction->status(), ['COMMITED', 'ROLLED_BACK'])) {
         $this->driverTransaction->begin();
     }
     $sts = [];
     foreach ($stack->statements() as $statement) {
         $sts[] = $statement;
     }
     return $this->driverTransaction->runMultiple($sts);
 }
Пример #2
0
 /**
  * @param StackInterface $stack
  *
  * @return ResultCollection|null
  *
  * @throws Neo4jException
  */
 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;
 }