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()]) ; $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => ['attributes' => ['order', 'photo', 'name', 'description','active']], 'pagination' => [ 'pageSize' => 20, ], ]); $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; } }