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