Author: Alexander Miertsch (contact@prooph.de)
Ejemplo n.º 1
0
 /**
  * Rollback transaction
  *
  * @triggers rollback
  */
 public function rollback()
 {
     if ($this->transactionLevel === 0) {
         throw new RuntimeException('Cannot rollback transaction. EventStore has no active transaction');
     }
     if (!$this->adapter instanceof CanHandleTransaction) {
         throw new RuntimeException('Adapter cannot handle transaction and therefore cannot rollback');
     }
     $this->adapter->rollback();
     $this->transactionLevel = 0;
     $event = $this->actionEventEmitter->getNewActionEvent(__FUNCTION__, $this);
     $this->actionEventEmitter->dispatch($event);
     $this->recordedEvents = [];
 }