/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = LicZama::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=8'); $query->leftJoin('valoresTramite att_Apellidos', 'att_Apellidos.tramiteId=Tramites.id and att_Apellidos.atributoId=9'); $query->leftJoin('valoresTramite att_Cvecatastral', 'att_Cvecatastral.tramiteId=Tramites.id and att_Cvecatastral.atributoId=10'); $query->leftJoin('valoresTramite att_escrituras', 'att_escrituras.tramiteId=Tramites.id and att_escrituras.atributoId=11'); $query->leftJoin('valoresTramite att_imprmirLicencia', 'att_imprmirLicencia.tramiteId=Tramites.id and att_imprmirLicencia.atributoId=12'); $query->andFilterWhere(['id' => $this->id, 'pasoActualId' => $this->pasoActualId, 'tipoTramiteId' => $this->tipoDeTramite()]); $query->andFilterWhere(['like', 'att_Nombre.valor', $this->Nombre])->andFilterWhere(['like', 'att_Apellidos.valor', $this->Apellidos])->andFilterWhere(['like', 'att_Cvecatastral.valor', $this->Cvecatastral])->andFilterWhere(['like', 'att_escrituras.valor', $this->escrituras])->andFilterWhere(['like', 'att_imprmirLicencia.valor', $this->imprmirLicencia]); return $dataProvider; }
/** * Finds the LicZama model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return LicZama the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = LicZama::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }