示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Ciudad::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(['id' => $this->id, 'pais_id' => $this->pais_id, 'region_id' => $this->region_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'pais_cd', $this->pais_cd])->andFilterWhere(['like', 'region_cd', $this->region_cd])->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
示例#2
0
 /**
  * Finds the Ciudad model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Ciudad the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Ciudad::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCiudads()
 {
     return $this->hasMany(Ciudad::className(), ['pais_id' => 'id']);
 }