/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Kota::find(); $dataproviderkota = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 20]]); $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 $dataproviderkota; } $query->andFilterWhere(['CITY_ID' => $this->CITY_ID, 'POSTAL_CODE' => $this->POSTAL_CODE]); $query->andFilterWhere(['like', 'PROVINCE_ID', $this->PROVINCE_ID])->andFilterWhere(['like', 'PROVINCE', $this->PROVINCE])->andFilterWhere(['like', 'TYPE', $this->TYPE])->andFilterWhere(['like', 'CITY_NAME', $this->CITY_NAME]); return $dataproviderkota; }
public function getCustkota() { return $this->hasOne(Kota::className(), ['POSTAL_CODE' => 'CITY_ID']); }
/** * Finds the Kategoricus model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Kategoricus the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModelkota($id) { if (($model = Kota::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }