/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Rrhh::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->andFilterWhere(['idRRHH' => $this->idRRHH, 'Edad' => $this->Edad, 'Salario' => $this->Salario, 'Jefe' => $this->Jefe]); $query->andFilterWhere(['like', 'Nombre', $this->Nombre])->andFilterWhere(['like', 'Apellido', $this->Apellido])->andFilterWhere(['like', 'descript', $this->descript])->andFilterWhere(['like', 'activate', $this->tablemode]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getRRHHIdRRHH() { return $this->hasOne(Rrhh::className(), ['idRRHH' => 'RRHH_idRRHH']); }
protected function findActiv($id) { if (($model = Rrhh::find()->where("idRRHH=:idRRHH", [":idRRHH" => $id])->andWhere("activate=:activate", [":activate" => 1])->one()) !== null) { return $model; } else { throw new NotFoundHttpException('Persona desactivada del sistema.'); } }
/** * Finds the Rrhh model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Rrhh the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Rrhh::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getAllRrhhZeroActivate() { return Rrhh::find()->where("activate=:activate", [":activate" => 0])->all(); }