/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Fund::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(['id' => $this->id, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'code', $this->code]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Fund::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 20]]); $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(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'num', $this->num])->andFilterWhere(['like', 'date', $this->date])->andFilterWhere(['like', 'week', $this->week])->andFilterWhere(['like', 'month', $this->month])->andFilterWhere(['like', 'quarter', $this->quarter])->andFilterWhere(['like', 'year', $this->year])->andFilterWhere(['like', 'three_year', $this->three_year])->andFilterWhere(['like', 'all', $this->all]); return $dataProvider; }
/** * Finds the Fund model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Fund the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Fund::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getFund() { return $this->hasOne(Fund::className(), ['id' => 'fund_id']); }