rollback() public method

Rollback transaction
public rollback ( )
示例#1
0
 /**
  * Save a Chapter event to the chapter history.
  *
  * @param Message $domainMessage
  * @throws \Prooph\Done\Shared\Exception\StoryName
  * @throws \Exception
  */
 public function logChapterEvent(Message $domainMessage)
 {
     $storyName = Metadata::getStoryNameFromMessage($domainMessage);
     if (!isset($this->storyTellers[$storyName->toString()])) {
         throw Exception\StoryName::isNotLinkedWithStoryTeller($storyName);
     }
     $storyTeller = $this->storyTellers[$storyName->toString()];
     try {
         $this->eventStore->beginTransaction();
         $storyTeller($domainMessage);
         $this->eventStore->commit();
     } catch (\Exception $ex) {
         $this->eventStore->rollback();
         throw $ex;
     }
 }
示例#2
0
 private function rollbackTransaction()
 {
     if ($this->inTransaction) {
         $this->eventStore->rollback();
     }
     $this->inTransaction = false;
     $this->checkMessageQueue();
 }
 /**
  * Check if exception an exception was thrown. If so rollback event store transaction
  * otherwise commit it.
  *
  * @param ActionEvent $actionEvent
  */
 public function onFinalize(ActionEvent $actionEvent)
 {
     if ($this->eventStore->isInTransaction()) {
         if ($actionEvent->getParam(CommandBus::EVENT_PARAM_EXCEPTION)) {
             $this->eventStore->rollback();
         } else {
             $this->eventStore->commit();
         }
     }
     $this->currentCommand = null;
 }