@@ -57,6 +57,8 @@ public function start($transactionOptions = []){
5757 if ($ this ->clientSession ->mongoSession ->isInTransaction ())
5858 throw new Exception ('Nested transaction not supported ' );
5959 $ 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 ().') ' );
6062 $ this ->clientSession ->mongoSession ->startTransaction ($ transactionOptions );
6163 Yii::debug ('MongoDB transaction started. ' , __METHOD__ );
6264 }
@@ -68,6 +70,8 @@ public function start($transactionOptions = []){
6870 public function commit (){
6971 Yii::debug ('Committing mongodb transaction ... ' , __METHOD__ );
7072 $ this ->clientSession ->mongoSession ->commitTransaction ();
73+ if ($ this ->mongoSession ->db ->enableLogging )
74+ Yii::endProfile ('mongodb > start transaction(session id => ' .$ this ->clientSession ->getId ().') ' );
7175 Yii::debug ('Commit mongodb transaction. ' , __METHOD__ );
7276 $ this ->clientSession ->db ->trigger (Connection::EVENT_COMMIT_TRANSACTION );
7377 }
@@ -79,6 +83,8 @@ public function commit(){
7983 public function rollBack (){
8084 Yii::debug ('Rolling back mongodb transaction ... ' , __METHOD__ );
8185 $ this ->clientSession ->mongoSession ->abortTransaction ();
86+ if ($ this ->mongoSession ->db ->enableLogging )
87+ Yii::endProfile ('mongodb > start transaction(session id => ' .$ this ->clientSession ->getId ().') ' );
8288 Yii::debug ('Roll back mongodb transaction. ' , __METHOD__ );
8389 $ this ->clientSession ->db ->trigger (Connection::EVENT_ROLLBACK_TRANSACTION );
8490 }
0 commit comments