/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Personal::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['cellphone_no' => $this->cellphone_no, 'date_of_birth' => $this->date_of_birth, 'age' => $this->age, 'height' => $this->height, 'weight' => $this->weight, 'personal_id' => $this->personal_id]); $query->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'middle_name', $this->middle_name])->andFilterWhere(['like', 'city_address', $this->city_address])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'sex', $this->sex])->andFilterWhere(['like', 'place_of_birth', $this->place_of_birth])->andFilterWhere(['like', 'nationality', $this->nationality])->andFilterWhere(['like', 'religion', $this->religion]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getApplicantPersonal() { return $this->hasOne(Personal::className(), ['personal_id' => 'applicant_personal_id']); }