/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = GoodsMovementDtlModel::find()->select(['goods_movement_dtl.*', 'product.*'])->with(['product', 'uom', 'movement'])->joinWith(['product']); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { $query->where('1=0'); return $dataProvider; } $query->andFilterWhere(['movement_id' => $this->movement_id, 'product_id' => $this->product_id, 'uom_id' => $this->uom_id, 'qty' => $this->qty, 'value' => $this->value, 'cogs' => $this->cogs]); return $dataProvider; }