Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Persona::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]);
     $query->andFilterWhere(['like', 'nombre_completo', $this->nombre_completo])->andFilterWhere(['like', 'pais', $this->pais])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Persona::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, 'municipio_id' => $this->municipio_id, 'tipo_identificacion_id' => $this->tipo_identificacion_id]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'apellido', $this->apellido])->andFilterWhere(['like', 'identificacion', $this->identificacion])->andFilterWhere(['like', 'direccion', $this->direccion])->andFilterWhere(['like', 'telefono', $this->telefono]);
     return $dataProvider;
 }
Ejemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPersonas()
 {
     return $this->hasMany(Persona::className(), ['municipio_id' => 'id']);
 }
Ejemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdPersona()
 {
     return $this->hasOne(Persona::className(), ['id' => 'id_persona']);
 }
Ejemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPersona()
 {
     return $this->hasOne(Persona::className(), ['id' => 'persona_id']);
 }
Ejemplo n.º 6
0
 /**
  * Finds the Persona model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Persona the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Persona::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPersonas()
 {
     return $this->hasMany(Persona::className(), ['tipo_identificacion_id' => 'id']);
 }
Ejemplo n.º 8
0
 public function buscarPorNombre($nombre)
 {
     return Persona::find()->where(['like', 'nombre_completo', $nombre]);
 }