@@ -40,7 +40,7 @@ class Transaction extends \yii\base\BaseObject
4040 * can [[commit()]] or [[rollBack()]].
4141 */
4242 public function getIsActive (){
43- return $ this ->clientSession ->db ->getIsActive () && $ this ->clientSession ->mongoSession -> isInTransaction ();
43+ return $ this ->clientSession ->db ->getIsActive () && $ this ->clientSession ->GetHasTransaction ();
4444 }
4545
4646 /**
@@ -54,10 +54,10 @@ public function getIsActive(){
5454 public function start ($ transactionOptions = []){
5555 Command::prepareCPOptions ($ transactionOptions );
5656 Yii::debug ('Starting mongodb transaction ... ' , __METHOD__ );
57- if ($ this ->clientSession ->mongoSession -> isInTransaction ())
57+ if ($ this ->clientSession ->GetHasTransaction ())
5858 throw new Exception ('Nested transaction not supported ' );
5959 $ this ->clientSession ->db ->trigger (Connection::EVENT_START_TRANSACTION );
60- if ($ this ->mongoSession ->db ->enableLogging )
60+ if ($ this ->clientSession ->db ->enableLogging )
6161 Yii::beginProfile ('mongodb > start transaction(session id => ' .$ this ->clientSession ->getId ().') ' );
6262 $ this ->clientSession ->mongoSession ->startTransaction ($ transactionOptions );
6363 Yii::debug ('MongoDB transaction started. ' , __METHOD__ );
@@ -70,7 +70,7 @@ public function start($transactionOptions = []){
7070 public function commit (){
7171 Yii::debug ('Committing mongodb transaction ... ' , __METHOD__ );
7272 $ this ->clientSession ->mongoSession ->commitTransaction ();
73- if ($ this ->mongoSession ->db ->enableLogging )
73+ if ($ this ->clientSession ->db ->enableLogging )
7474 Yii::endProfile ('mongodb > start transaction(session id => ' .$ this ->clientSession ->getId ().') ' );
7575 Yii::debug ('Commit mongodb transaction. ' , __METHOD__ );
7676 $ this ->clientSession ->db ->trigger (Connection::EVENT_COMMIT_TRANSACTION );
@@ -83,7 +83,7 @@ public function commit(){
8383 public function rollBack (){
8484 Yii::debug ('Rolling back mongodb transaction ... ' , __METHOD__ );
8585 $ this ->clientSession ->mongoSession ->abortTransaction ();
86- if ($ this ->mongoSession ->db ->enableLogging )
86+ if ($ this ->clientSession ->db ->enableLogging )
8787 Yii::endProfile ('mongodb > start transaction(session id => ' .$ this ->clientSession ->getId ().') ' );
8888 Yii::debug ('Roll back mongodb transaction. ' , __METHOD__ );
8989 $ this ->clientSession ->db ->trigger (Connection::EVENT_ROLLBACK_TRANSACTION );
0 commit comments