/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Investor::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(['like', 'investor_user_name', $this->investor_user_name])->andFilterWhere(['like', 'investor_first_name', $this->investor_first_name])->andFilterWhere(['like', 'investor_last_name', $this->investor_last_name])->andFilterWhere(['like', 'investor_address1', $this->investor_address1])->andFilterWhere(['like', 'investor_address2', $this->investor_address2])->andFilterWhere(['like', 'investor_email', $this->investor_email])->andFilterWhere(['like', 'investor_gender', $this->investor_gender]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getInvestor() { return $this->hasOne(Investor::className(), ['investor_user_name' => 'user_name']); }
/** * Finds the Investor model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Investor the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Investor::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }