From 85e8ff202249d25c3ec084ff47fc4a661f82eb71 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 28 Jan 2012 20:29:08 +0400 Subject: [PATCH] connection wasn't properly returned in case of being created --- framework/logging/DbTarget.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/framework/logging/DbTarget.php b/framework/logging/DbTarget.php index 3a6da3a..e1de968 100644 --- a/framework/logging/DbTarget.php +++ b/framework/logging/DbTarget.php @@ -68,13 +68,13 @@ class DbTarget extends Target */ public function getDbConnection() { - if ($this->_db !== null) { - return $this->_db; - } - $this->_db = \Yii::$application->getComponent($this->connectionID); - if (!$this->_db instanceof \yii\db\dao\Connection) { - throw new \yii\base\Exception('DbTarget.connectionID must refer to a valid application component ID'); + if ($this->_db === null) { + $this->_db = \Yii::$application->getComponent($this->connectionID); + if (!$this->_db instanceof \yii\db\dao\Connection) { + throw new \yii\base\Exception('DbTarget.connectionID must refer to a valid application component ID'); + } } + return $this->_db; } /**