Exemple #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Chofer::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(['cho_fecha_nac' => $this->cho_fecha_nac, 'cho_telefono' => $this->cho_telefono, 'cho_sueldo' => $this->cho_sueldo]);
     $query->andFilterWhere(['like', 'cho_rut', $this->cho_rut])->andFilterWhere(['like', 'cho_num_licencia', $this->cho_num_licencia])->andFilterWhere(['like', 'cho_primer_nombre', $this->cho_primer_nombre])->andFilterWhere(['like', 'cho_segundo_nombre', $this->cho_segundo_nombre])->andFilterWhere(['like', 'cho_apell_paterno', $this->cho_apell_paterno])->andFilterWhere(['like', 'cho_apell_materno', $this->cho_apell_materno])->andFilterWhere(['like', 'cho_direccion', $this->cho_direccion])->andFilterWhere(['like', 'cho_email', $this->cho_email])->andFilterWhere(['like', 'cho_imagen', $this->cho_imagen]);
     return $dataProvider;
 }
Exemple #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getChoRuts()
 {
     return $this->hasMany(Chofer::className(), ['cho_rut' => 'cho_rut'])->viaTable('emp_contrata_cho', ['emp_rut' => 'emp_rut']);
 }
Exemple #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getChoRuts()
 {
     return $this->hasMany(Chofer::className(), ['cho_rut' => 'cho_rut'])->viaTable('uni_veh_cho', ['veh_patente' => 'veh_patente']);
 }
 /**
  * Finds the Chofer model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Chofer the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Chofer::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }