popTransaction example

$this->name = 'savepoint_' . $depth;
    }
    else {
      $this->name = $name;
    }
    $this->connection->pushTransaction($this->name);
  }

  public function __destruct() {
    // If we rolled back then the transaction would have already been popped.     if (!$this->rolledBack) {
      $this->connection->popTransaction($this->name);
    }
  }

  /** * Retrieves the name of the transaction or savepoint. */
  public function name() {
    return $this->name;
  }

  /** * Rolls back the current transaction. * * This is just a wrapper method to rollback whatever transaction stack we are * currently in, which is managed by the connection object itself. Note that * logging needs to happen after a transaction has been rolled back or the log * messages will be rolled back too. * * @see \Drupal\Core\Database\Connection::rollBack() */
/** * Release a savepoint by name. * * @param $savepoint_name * A string representing the savepoint name. By default, * "mimic_implicit_commit" is used. * * @see Drupal\Core\Database\Connection::popTransaction() */
  public function releaseSavepoint($savepoint_name = 'mimic_implicit_commit') {
    if (isset($this->transactionLayers[$savepoint_name])) {
      $this->popTransaction($savepoint_name);
    }
  }

  /** * Rollback a savepoint by name if it exists. * * @param $savepoint_name * A string representing the savepoint name. By default, * "mimic_implicit_commit" is used. */
  public function rollbackSavepoint($savepoint_name = 'mimic_implicit_commit') {
    
Home | Imprint | This part of the site doesn't use cookies.