namespace common\ext;useYii;useyii\base\InvalidConfigException;useyii\base\NotSupportedException;useyii\db\Connection;use yii\db\Exception;useyii\db\Transaction;/**
* 事务拓展类
*
* Class TransactionExt
* @package common\ext*/
class TransactionExt extendsTransaction
{/**
* @var int the nesting level of the transaction. 0 means the outermost level.*/
private $_level = 0;/**
* Returns a value indicating whether this transaction is active.
* @return bool whether this transaction is active. Only an active transaction
* can [[commit()]] or [[rollBack()]].*/
public functiongetIsActive()
{return $this->_level > 0 && $this->db && $this->db->isActive;
}/**
* 覆写开始事务method
*
* @param string|null $isolationLevel The [isolation level][] to use for this transaction.