public function search($params) { $query = ServicioSalud::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'codigo', $this->codigo])->andFilterWhere(['like', 'abreviatura', $this->abreviatura])->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'sitio_web', $this->sitio_web]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getServicioSalud() { return $this->hasOne(ServicioSalud::className(), ['id' => 'servicio_salud_id']); }
/** * Finds the ServicioSalud model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return ServicioSalud the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = ServicioSalud::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }