/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = LicUsoSueloVictor::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->leftJoin('valoresTramite att_nombre', 'att_nombre.tramiteId=Tramites.id and att_nombre.atributoId=1129'); $query->leftJoin('valoresTramite att_direccion', 'att_direccion.tramiteId=Tramites.id and att_direccion.atributoId=1130'); $query->leftJoin('valoresTramite att_p2DictamenImpactoAmbiental', 'att_p2DictamenImpactoAmbiental.tramiteId=Tramites.id and att_p2DictamenImpactoAmbiental.atributoId=1131'); $query->andFilterWhere(['id' => $this->id, 'pasoActualId' => $this->pasoActualId, 'tipoTramiteId' => $this->tipoDeTramite(), 'att_fechaCreacion' => $this->fechaCreacion, 'att_fechaModificacion' => $this->fechaModificacion, 'att_estatusId' => $this->estatusId]); $query->andFilterWhere(['like', 'att_observaciones.valor', $this->observaciones])->andFilterWhere(['like', 'att_nombre.valor', $this->nombre])->andFilterWhere(['like', 'att_direccion.valor', $this->direccion])->andFilterWhere(['like', 'att_p2DictamenImpactoAmbiental.valor', $this->p2DictamenImpactoAmbiental]); return $dataProvider; }
/** * Finds the LicUsoSueloVictor model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return LicUsoSueloVictor the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = LicUsoSueloVictor::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }