File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,14 @@ public function getHasTransaction(){
138138 return !empty ($ this ->_transaction );
139139 }
140140
141+ /**
142+ * Returns whether a multi-document transaction is in progress
143+ * @return bool
144+ */
145+ public function getInTransaction (){
146+ return $ this ->mongoSession ->isInTransaction ();
147+ }
148+
141149 /**
142150 * End current session
143151 */
Original file line number Diff line number Diff line change @@ -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 ->GetHasTransaction ();
43+ return $ this ->clientSession ->db ->getIsActive () && $ this ->clientSession ->getInTransaction ();
4444 }
4545
4646 /**
@@ -54,7 +54,7 @@ public function getIsActive(){
5454 public function start ($ transactionOptions = []){
5555 Command::prepareCPOptions ($ transactionOptions );
5656 Yii::debug ('Starting mongodb transaction ... ' , __METHOD__ );
57- if ($ this ->clientSession ->GetHasTransaction ())
57+ if ($ this ->clientSession ->getInTransaction ())
5858 throw new Exception ('Nested transaction not supported ' );
5959 $ this ->clientSession ->db ->trigger (Connection::EVENT_START_TRANSACTION );
6060 if ($ this ->clientSession ->db ->enableLogging )
You can’t perform that action at this time.
0 commit comments