src/Leevel/Database/Connect.php
public function rollBack(): void
    {
        if (0 === $this->transactionLevel) {
            throw new InvalidArgumentException('There was no active transaction.');
        }

        if (1 === $this->transactionLevel) {
            $this->transactionLevel = 0;

            $this->pdo(true)->rollBack();

            $this->isRollbackOnly = false;
        } elseif ($this->transactionLevel > 1 && $this->hasSavepoints()) {
            $this->rollbackSavepoint($this->getSavepointName());
            $this->transactionLevel--;
        } else {
            $this->isRollbackOnly = true;
            $this->transactionLevel = max(0, $this->transactionLevel - 1);
        }
    }
public function rollBack(): void
    {
        if (0 === $this->transactionLevel) {
            throw new InvalidArgumentException('There was no active transaction.');
        }

        if (1 === $this->transactionLevel) {
            $this->transactionLevel = 0;

            $this->pdo(true)->rollBack();

            $this->isRollbackOnly = false;
        } elseif ($this->transactionLevel > 1 && $this->hasSavepoints()) {
            $this->rollbackSavepoint($this->getSavepointName());
            $this->transactionLevel--;
        } else {
            $this->isRollbackOnly = true;
            $this->transactionLevel = max(0, $this->transactionLevel - 1);
        }
    }
事务回滚.