@@ -57,6 +57,8 @@ public function start($transactionOptions = []){
57
57
if ($ this ->clientSession ->mongoSession ->isInTransaction ())
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 )
61
+ Yii::beginProfile ('mongodb > start transaction(session id => ' .$ this ->clientSession ->getId ().') ' );
60
62
$ this ->clientSession ->mongoSession ->startTransaction ($ transactionOptions );
61
63
Yii::debug ('MongoDB transaction started. ' , __METHOD__ );
62
64
}
@@ -68,6 +70,8 @@ public function start($transactionOptions = []){
68
70
public function commit (){
69
71
Yii::debug ('Committing mongodb transaction ... ' , __METHOD__ );
70
72
$ this ->clientSession ->mongoSession ->commitTransaction ();
73
+ if ($ this ->mongoSession ->db ->enableLogging )
74
+ Yii::endProfile ('mongodb > start transaction(session id => ' .$ this ->clientSession ->getId ().') ' );
71
75
Yii::debug ('Commit mongodb transaction. ' , __METHOD__ );
72
76
$ this ->clientSession ->db ->trigger (Connection::EVENT_COMMIT_TRANSACTION );
73
77
}
@@ -79,6 +83,8 @@ public function commit(){
79
83
public function rollBack (){
80
84
Yii::debug ('Rolling back mongodb transaction ... ' , __METHOD__ );
81
85
$ this ->clientSession ->mongoSession ->abortTransaction ();
86
+ if ($ this ->mongoSession ->db ->enableLogging )
87
+ Yii::endProfile ('mongodb > start transaction(session id => ' .$ this ->clientSession ->getId ().') ' );
82
88
Yii::debug ('Roll back mongodb transaction. ' , __METHOD__ );
83
89
$ this ->clientSession ->db ->trigger (Connection::EVENT_ROLLBACK_TRANSACTION );
84
90
}
0 commit comments