/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Inversiones::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(['idinversion' => $this->idinversion, 'empresas_id' => $this->empresas_id, 'anio' => $this->anio, 'inversion' => $this->inversion, 'fecha_campana' => $this->fecha_campana]); $query->andFilterWhere(['like', 'monto_propuesta', $this->monto_propuesta])->andFilterWhere(['like', 'productos_interes', $this->productos_interes])->andFilterWhere(['like', 'comentarios', $this->comentarios])->andFilterWhere(['like', 'propuesta', $this->propuesta])->andFilterWhere(['like', 'campana', $this->campana])->andFilterWhere(['like', 'temporalidad', $this->temporalidad]); return $dataProvider; }
/** * Finds the Inversiones model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Inversiones the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Inversiones::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getInversiones() { return $this->hasMany(Inversiones::className(), ['empresa_id' => 'idempresa']); }