Commit 01ae0150 by Qiang Xue

Fixes issue #180: DbSession crashes with autoStart

parent 51357e58
...@@ -71,13 +71,13 @@ class DbSession extends Session ...@@ -71,13 +71,13 @@ class DbSession extends Session
*/ */
public function init() public function init()
{ {
parent::init();
if (is_string($this->db)) { if (is_string($this->db)) {
$this->db = Yii::$app->getComponent($this->db); $this->db = Yii::$app->getComponent($this->db);
} }
if (!$this->db instanceof Connection) { if (!$this->db instanceof Connection) {
throw new InvalidConfigException("DbSession::db must be either a DB connection instance or the application component ID of a DB connection."); throw new InvalidConfigException("DbSession::db must be either a DB connection instance or the application component ID of a DB connection.");
} }
parent::init();
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment