/** * 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; }
/** * 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; }
/** * @return \yii\db\ActiveQuery */ public function getPersonas() { return $this->hasMany(Persona::className(), ['municipio_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getIdPersona() { return $this->hasOne(Persona::className(), ['id' => 'id_persona']); }
/** * @return \yii\db\ActiveQuery */ public function getPersona() { return $this->hasOne(Persona::className(), ['id' => 'persona_id']); }
/** * 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.'); } }
/** * @return \yii\db\ActiveQuery */ public function getPersonas() { return $this->hasMany(Persona::className(), ['tipo_identificacion_id' => 'id']); }
public function buscarPorNombre($nombre) { return Persona::find()->where(['like', 'nombre_completo', $nombre]); }