255], ['id_producer', 'integer'], ]; } public function search($params) { $optionsSearch = self::defaultOptionsSearch() ; $query = ProductCategory::find() ->with($optionsSearch['with']) ->innerJoinWith($optionsSearch['join_with'], true) ->where(['product_category.id_producer' => GlobalParam::getCurrentProducerId()]) ->orderBy('product_category.position ASC') ; $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => ['attributes' => ['name']], 'pagination' => [ 'pageSize' => 20, ], ]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['like', 'product_category.name', $this->name]) ; return $dataProvider; } }