@@ -40,7 +40,7 @@ class Transaction extends \yii\base\BaseObject
40
40
* can [[commit()]] or [[rollBack()]].
41
41
*/
42
42
public function getIsActive (){
43
- return $ this ->clientSession ->db ->getIsActive () && $ this ->clientSession ->mongoSession -> isInTransaction ();
43
+ return $ this ->clientSession ->db ->getIsActive () && $ this ->clientSession ->GetHasTransaction ();
44
44
}
45
45
46
46
/**
@@ -54,10 +54,10 @@ public function getIsActive(){
54
54
public function start ($ transactionOptions = []){
55
55
Command::prepareCPOptions ($ transactionOptions );
56
56
Yii::debug ('Starting mongodb transaction ... ' , __METHOD__ );
57
- if ($ this ->clientSession ->mongoSession -> isInTransaction ())
57
+ if ($ this ->clientSession ->GetHasTransaction ())
58
58
throw new Exception ('Nested transaction not supported ' );
59
59
$ this ->clientSession ->db ->trigger (Connection::EVENT_START_TRANSACTION );
60
- if ($ this ->mongoSession ->db ->enableLogging )
60
+ if ($ this ->clientSession ->db ->enableLogging )
61
61
Yii::beginProfile ('mongodb > start transaction(session id => ' .$ this ->clientSession ->getId ().') ' );
62
62
$ this ->clientSession ->mongoSession ->startTransaction ($ transactionOptions );
63
63
Yii::debug ('MongoDB transaction started. ' , __METHOD__ );
@@ -70,7 +70,7 @@ public function start($transactionOptions = []){
70
70
public function commit (){
71
71
Yii::debug ('Committing mongodb transaction ... ' , __METHOD__ );
72
72
$ this ->clientSession ->mongoSession ->commitTransaction ();
73
- if ($ this ->mongoSession ->db ->enableLogging )
73
+ if ($ this ->clientSession ->db ->enableLogging )
74
74
Yii::endProfile ('mongodb > start transaction(session id => ' .$ this ->clientSession ->getId ().') ' );
75
75
Yii::debug ('Commit mongodb transaction. ' , __METHOD__ );
76
76
$ this ->clientSession ->db ->trigger (Connection::EVENT_COMMIT_TRANSACTION );
@@ -83,7 +83,7 @@ public function commit(){
83
83
public function rollBack (){
84
84
Yii::debug ('Rolling back mongodb transaction ... ' , __METHOD__ );
85
85
$ this ->clientSession ->mongoSession ->abortTransaction ();
86
- if ($ this ->mongoSession ->db ->enableLogging )
86
+ if ($ this ->clientSession ->db ->enableLogging )
87
87
Yii::endProfile ('mongodb > start transaction(session id => ' .$ this ->clientSession ->getId ().') ' );
88
88
Yii::debug ('Roll back mongodb transaction. ' , __METHOD__ );
89
89
$ this ->clientSession ->db ->trigger (Connection::EVENT_ROLLBACK_TRANSACTION );
0 commit comments