/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = StockOpnameDtlModel::find()->with('products'); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { $query->where('1=0'); return $dataProvider; } $query->andFilterWhere(['id_opname' => $this->id_opname, 'id_product' => $this->id_product, 'id_uom' => $this->id_uom, 'qty' => $this->qty]); return $dataProvider; }