Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = WAPROVINCE::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', 'PROVINCE_CODE', $this->PROVINCE_CODE])->andFilterWhere(['like', 'REGION_CODE', $this->REGION_CODE])->andFilterWhere(['like', 'ZONE_CODE', $this->ZONE_CODE])->andFilterWhere(['like', 'PROVINCE_NAME_TH', $this->PROVINCE_NAME_TH])->andFilterWhere(['like', 'PROVINCE_NAME_EN', $this->PROVINCE_NAME_EN])->andFilterWhere(['like', 'CREATE_USER_ID', $this->CREATE_USER_ID])->andFilterWhere(['like', 'CREATE_TIME', $this->CREATE_TIME])->andFilterWhere(['like', 'LAST_UPD_USER_ID', $this->LAST_UPD_USER_ID])->andFilterWhere(['like', 'LAST_UPD_TIME', $this->LAST_UPD_TIME]);
     return $dataProvider;
 }
Example #2
0
 /**
  * Finds the WAPROVINCE model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return WAPROVINCE the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = WAPROVINCE::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }