modelClass); $searchModelClass = FileHelper::basename($generator->searchModelClass); $rules = $generator->generateSearchRules(); $labels = $generator->generateSearchLabels(); $searchAttributes = $generator->getSearchAttributes(); $searchConditions = $generator->generateSearchConditions(); echo " namespace searchModelClass, '\\')) ?>; use yii\base\Model; use yii\data\ActiveDataProvider; use modelClass, '\\') ?>; /** * represents the model behind the search form about . */ class extends Model { public $; public function rules() { return [ , ]; } /** * @inheritdoc */ public function attributeLabels() { return [ $label): ?> '" . addslashes($label) . "',\n" ?> ]; } public function search($params) { $query = ::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } return $dataProvider; } protected function addCondition($query, $attribute, $partialMatch = false) { $value = $this->$attribute; if (trim($value) === '') { return; } if ($partialMatch) { $value = '%' . strtr($value, ['%'=>'\%', '_'=>'\_', '\\'=>'\\\\']) . '%'; $query->andWhere(['like', $attribute, $value]); } else { $query->andWhere([$attribute => $value]); } } }