Dibi\Connection::rollback PHP Method

rollback() public method

Rollback changes in a transaction.
public rollback ( $savepoint = NULL ) : void
return void
    public function rollback($savepoint = NULL)
    {
        $this->connected || $this->connect();
        $event = $this->onEvent ? new Event($this, Event::ROLLBACK, $savepoint) : NULL;
        try {
            $this->driver->rollback($savepoint);
            $event && $this->onEvent($event->done());
        } catch (Exception $e) {
            $event && $this->onEvent($event->done($e));
            throw $e;
        }
    }

Usage Example

Example #1
0
 public final function run()
 {
     $this->dibiConnection->begin();
     try {
         parent::run();
     } catch (\Exception $e) {
         $this->dibiConnection->rollback();
         throw $e;
     }
     $this->dibiConnection->commit();
 }
All Usage Examples Of Dibi\Connection::rollback