From 3185c2615f65cc86ad84e4549c318dc7a0a063d1 Mon Sep 17 00:00:00 2001 From: Ziaratban Date: Thu, 1 Oct 2020 23:18:29 +0330 Subject: [PATCH] fix bug https://github.com/yiisoft/yii2-mongodb/pull/314 --- src/ClientSession.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ClientSession.php b/src/ClientSession.php index cb566e918..058fd527c 100644 --- a/src/ClientSession.php +++ b/src/ClientSession.php @@ -110,13 +110,15 @@ public function getId(){ */ public static function start($db, $sessionOptions = []){ self::prepareOptions($sessionOptions); - Yii::debug('Starting mongodb session ...', __METHOD__); + if($db->enableProfiling) + Yii::debug('Starting mongodb session ...', __METHOD__); $db->trigger(Connection::EVENT_START_SESSION); $newSession = new self([ 'db' => $db, 'mongoSession' => $db->manager->startSession($sessionOptions), ]); - Yii::debug('MongoDB session started.', __METHOD__); + if($db->enableProfiling) + Yii::debug('MongoDB session started.', __METHOD__); return $newSession; }