Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $company = Company::findOne(['user_id' => Yii::$app->user->id]);
     $query = UserCv::find()->innerJoin('user', 'user_cv.user_id = user.id')->where('user.company_id=:companyid', [':companyid' => $company->id]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id]);
     $query->andFilterWhere(['like', 'huidige_beroep', $this->huidige_beroep])->andFilterWhere(['like', 'huidge_werkgever', $this->huidge_werkgever])->andFilterWhere(['like', 'voornaam', $this->voornaam])->andFilterWhere(['like', 'tussenvoegsel', $this->tussenvoegsel])->andFilterWhere(['like', 'achternaam', $this->achternaam])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'telefoon', $this->telefoon])->andFilterWhere(['like', 'mobiel', $this->mobiel])->andFilterWhere(['like', 'postcode', $this->postcode])->andFilterWhere(['like', 'huisnummer', $this->huisnummer])->andFilterWhere(['like', 'toevoeging', $this->toevoeging])->andFilterWhere(['like', 'straat', $this->straat])->andFilterWhere(['like', 'rijbewijs', $this->rijbewijs])->andFilterWhere(['like', 'geboortejaar', $this->geboortejaar])->andFilterWhere(['like', 'geboortemaand', $this->geboortemaand])->andFilterWhere(['like', 'geboortedag', $this->geboortedag])->andFilterWhere(['like', 'geboorteplaats', $this->geboorteplaats])->andFilterWhere(['like', 'nationaliteit', $this->nationaliteit])->andFilterWhere(['like', 'branch', $this->branch])->andFilterWhere(['like', 'branch_discipline', $this->branch_discipline])->andFilterWhere(['like', 'branch_specialisatie', $this->branch_specialisatie]);
     return $dataProvider;
 }