Browse Source

connection wasn't properly returned in case of being created

tags/2.0.0-beta
Alexander Makarov 13 years ago
parent
commit
85e8ff2022
  1. 12
      framework/logging/DbTarget.php

12
framework/logging/DbTarget.php

@ -68,13 +68,13 @@ class DbTarget extends Target
*/ */
public function getDbConnection() public function getDbConnection()
{ {
if ($this->_db !== null) { if ($this->_db === null) {
return $this->_db; $this->_db = \Yii::$application->getComponent($this->connectionID);
} if (!$this->_db instanceof \yii\db\dao\Connection) {
$this->_db = \Yii::$application->getComponent($this->connectionID); throw new \yii\base\Exception('DbTarget.connectionID must refer to a valid application component ID');
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;
} }
/** /**

Loading…
Cancel
Save