255], ]; } public function search($params) { $optionsSearch = self::defaultOptionsSearch(); $query = Invoice::find() ->with($optionsSearch['with']) ->where(['invoice.id_producer' => GlobalParam::getCurrentProducerId()]) ->orderBy('invoice.status ASC, invoice.reference DESC'); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => ['attributes' => ['name', 'reference', 'date']], 'pagination' => [ 'pageSize' => 20, ], ]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['like', 'invoice.name', $this->name]); $query->andFilterWhere(['like', 'invoice.reference', $this->reference]); $query->andFilterWhere(['like', 'invoice.status', $this->status]); return $dataProvider; } }