/** * {@inheritdoc} */ public function init() { parent::init(); $this->db = Yii::$app->db; if (!isset($this->modelClass)) { throw new InvalidConfigException('"modelClass" must be set.'); } }
/** * @inheritdoc */ public function init() { parent::init(); if (is_string($this->db)) { $this->db = Yii::$app->getComponent($this->db); } if (!is_object($this->db)) { throw new InvalidConfigException("The 'db' property must be either a DB connection instance or the application component ID of a DB connection."); } }
/** * @inheritdoc */ public function init() { parent::init(); $this->db = Instance::ensure($this->db, Object::className()); }