yii\data\SqlDataProvider::init PHP Method

init() public method

This method will initialize the [[db]] property to make sure it refers to a valid DB connection.
public init ( )
    public function init()
    {
        parent::init();
        $this->db = Instance::ensure($this->db, Connection::className());
        if ($this->sql === null) {
            throw new InvalidConfigException('The "sql" property must be set.');
        }
    }