yii\data\ActiveDataProvider::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();
        if (is_string($this->db)) {
            $this->db = Instance::ensure($this->db, Connection::className());
        }
    }

Usage Example

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!is_callable($this->mapFunction)) {
         throw new \yii\base\InvalidConfigException('You must specify a function for execution `mapFunction`');
     }
 }
All Usage Examples Of yii\data\ActiveDataProvider::init