public function search($params)
 {
     $query = ServicioSaludContacto::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'servicio_salud_id' => $this->servicio_salud_id, 'pais_id' => $this->pais_id, 'provincia_id' => $this->provincia_id, 'ciudad_id' => $this->ciudad_id, 'contacto_preferido' => $this->contacto_preferido]);
     $query->andFilterWhere(['like', 'direccion', $this->direccion])->andFilterWhere(['like', 'cp', $this->cp])->andFilterWhere(['like', 'telefono', $this->telefono])->andFilterWhere(['like', 'telefono_alternativo', $this->telefono_alternativo])->andFilterWhere(['like', 'observaciones', $this->observaciones]);
     return $dataProvider;
 }
예제 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getServicioSaludContactos()
 {
     return $this->hasMany(ServicioSaludContacto::className(), ['servicio_salud_domicilio_id' => 'id']);
 }
 /**
  * Finds the ServicioSaludContacto model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return ServicioSaludContacto the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = ServicioSaludContacto::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }