/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Withholding::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->joinWith('scholarScholar'); $query->andFilterWhere(['withholding_id' => $this->withholding_id, 'scholar_scholar_id' => $this->scholar_scholar_id, 'scholar_school_school_id' => $this->scholar_school_school_id, 'withholding_start_date' => $this->withholding_start_date, 'withholding_end_date' => $this->withholding_end_date]); $query->andFilterWhere(['like', 'scholar_allowance_allowance_area', $this->scholar_allowance_allowance_area])->andFilterWhere(['like', 'withholding_remark', $this->withholding_remark])->andFilterWhere(['like', 'scholar.scholar_first_name', $this->firstName])->andFilterWhere(['like', 'scholar.scholar_middle_name', $this->middleName])->andFilterWhere(['like', 'scholar.scholar_last_name', $this->lastName]); return $dataProvider; }
/** * Finds the Withholding model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $withholding_id * @param integer $scholar_scholar_id * @param integer $scholar_school_school_id * @param string $scholar_allowance_allowance_area * @return Withholding the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Withholding::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getWithholdings1() { return $this->hasMany(Withholding::className(), ['scholar_allowance_allowance_area' => 'allowance_allowance_area']); }