Пример #1
0
 public function actionDeleteAll()
 {
     $tiempo_inicio = microtime(true);
     $model = Persona::find()->all();
     foreach ($model as $i => $persona) {
         $persona->delete();
     }
     $tiempo_fin = microtime(true);
     $mensaje = 'Tiempo empleado para eliminar ' . count($model) . ' tuplas: ' . ($tiempo_fin - $tiempo_inicio);
     $this->redirect(['index', 'mensaje' => $mensaje]);
 }
Пример #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]);
     $query->andFilterWhere(['like', 'nombre_completo', $this->nombre_completo])->andFilterWhere(['like', 'pais', $this->pais])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
Пример #3
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;
 }
Пример #4
0
 public function buscarPorNombre($nombre)
 {
     return Persona::find()->where(['like', 'nombre_completo', $nombre]);
 }