/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ActsDoc::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id_doc' => $this->id_doc, 'type_act' => $this->type_act, 'begdate' => $this->begdate, 'enddate' => $this->enddate, 'control' => $this->control, 'user_id' => $this->user_id, 'beg_sald' => $this->beg_sald, 'end_sald' => $this->end_sald]); $query->andFilterWhere(['like', 'num_act', $this->num_act])->andFilterWhere(['like', 'contr_doc', $this->contr_doc]); return $dataProvider; }
/** * Finds the ActsDoc model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return ActsDoc the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = ActsDoc::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('Запрашиваемая страница не доступна.'); } }