Skip to content

Commit 97cccff

Browse files
committed
fix bug
1 parent 507a4dd commit 97cccff

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/ClientSession.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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
*/

src/Transaction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)