예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Incentive::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(['incentive_id' => $this->incentive_id, 'scholar_scholar_id' => $this->scholar_scholar_id, 'scholar_school_school_id' => $this->scholar_school_school_id, 'incentive_amount' => $this->incentive_amount, 'incentive_date' => $this->incentive_date]);
     $query->andFilterWhere(['like', 'scholar_allowance_allowance_area', $this->scholar_allowance_allowance_area])->andFilterWhere(['like', 'incentive_remark', $this->incentive_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;
 }
예제 #2
0
 /**
  * Finds the Incentive model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Incentive the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Incentive::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIncentives1()
 {
     return $this->hasMany(Incentive::className(), ['scholar_allowance_allowance_area' => 'allowance_allowance_area']);
 }