/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = TblFuncionario::find()->leftJoin('tbl_persona', 'tbl_funcionario.id=tbl_persona.id')->with(['idProfesion', 'idFuncionario']); $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, 'id_unidad' => $this->id_unidad, 'item' => $this->item, 'fech_ingreso' => $this->fech_ingreso, 'antiguedad' => $this->antiguedad, 'id_tipoempleado' => $this->id_tipoempleado, 'id_profesion' => $this->id_profesion]); $query->andFilterWhere(['like', 'nit', $this->nit])->andFilterWhere(['like', 'estado', $this->estado])->andFilterWhere(['like', 'jefe_superior', $this->jefe_superior])->andFilterWhere(['like', 'estado_bono', $this->estado_bono])->andFilterWhere(['like', 'subsidio', $this->subsidio])->andFilterWhere(['like', 'controltratamiento', $this->controltratamiento])->andFilterWhere(['like', 'tbl_persona.ci', $this->ci])->andFilterWhere(['like', 'tbl_persona.ap_paterno', $this->nombre])->orFilterWhere(['like', 'tbl_persona.ap_materno', $this->nombre])->orFilterWhere(['like', 'tbl_persona.nombres', $this->nombre]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getTblFuncionarios() { return $this->hasMany(TblFuncionario::className(), ['id_unidad' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getTblFuncionarios() { return $this->hasMany(TblFuncionario::className(), ['id_tipoempleado' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getId0() { return $this->hasOne(TblFuncionario::className(), ['id' => 'id']); }
/** * Finds the TblFuncionario model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return TblFuncionario the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = TblFuncionario::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }