255], [['recipe'], 'string', 'max' => 1000], ]; } public function search($params) { $optionsSearch = self::defaultOptionsSearch() ; $query = Product::find() ->with($optionsSearch['with']) ->innerJoinWith($optionsSearch['join_with'], true) ->where(['product.id_producer' => Producer::getId()]) ->orderBy('product.order ASC') ; $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => ['attributes' => ['order', 'photo', 'name', 'description','active']], 'pagination' => [ 'pageSize' => 1000, ], ]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['like', 'product.name', $this->name]) ; $query->andFilterWhere(['like', 'product.description', $this->description]) ; if(isset($this->active) && is_numeric($this->active)) { $query->andWhere([ 'product.active' => $this->active ]) ; } return $dataProvider; } }