'Город', 'specialization' => 'Специализация' ]; } /** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $this->load($params); $query = Vacancy::find() ->distinct(true) ->joinWith(['specializations', 'user']) ->andWhere(['user.type' => 2]); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $query; } $query->andFilterWhere([ 'vacancy.city' => $this->city, 'specialization.specialization_id' => $this->specialization, ]); return $query; } }