/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = EmpresaPyme::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(['emp_telefono' => $this->emp_telefono]); $query->andFilterWhere(['like', 'emp_rut', $this->emp_rut])->andFilterWhere(['like', 'emp_nombre', $this->emp_nombre])->andFilterWhere(['like', 'emp_giro', $this->emp_giro])->andFilterWhere(['like', 'emp_rubro', $this->emp_rubro])->andFilterWhere(['like', 'emp_direccion', $this->emp_direccion])->andFilterWhere(['like', 'emp_email', $this->emp_email])->andFilterWhere(['like', 'emp_descripcion', $this->emp_descripcion]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getEmpRut() { return $this->hasOne(EmpresaPyme::className(), ['emp_rut' => 'emp_rut']); }
/** * Finds the EmpresaPyme model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return EmpresaPyme the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = EmpresaPyme::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getEmpRuts() { return $this->hasMany(EmpresaPyme::className(), ['emp_rut' => 'emp_rut'])->viaTable('emp_contrata_cho', ['cho_rut' => 'cho_rut']); }
/** * @return \yii\db\ActiveQuery */ public function getEmpRuts() { return $this->hasMany(EmpresaPyme::className(), ['emp_rut' => 'emp_rut'])->viaTable('emp_contrata_serv', ['ser_codigo' => 'ser_codigo']); }