/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Empresas::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(['idempresa' => $this->idempresa, 'user_id' => $this->user_id]); $query->andFilterWhere(['like', 'cuenta', $this->cuenta])->andFilterWhere(['like', 'status', $this->status]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Empresas::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(['idempresas' => $this->idempresas, 'user_id' => $this->user_id, 'tipo_cliente_id' => $this->tipo_cliente_id]); $query->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'cabeza_sector', $this->cabeza_sector])->andFilterWhere(['like', 'cuenta', $this->cuenta])->andFilterWhere(['like', 'siglas', $this->siglas])->andFilterWhere(['like', 'nat_juridica', $this->nat_juridica])->andFilterWhere(['like', 'categoria', $this->categoria])->andFilterWhere(['like', 'subcuenta', $this->subcuenta]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getEmpresas() { return $this->hasOne(Empresas::className(), ['idempresas' => 'empresas_id']); }
/** * Finds the Empresas model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Empresas the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Empresas::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getEmpresas() { return $this->hasMany(Empresas::className(), ['tipo_cliente_id' => 'id']); }