/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Reqform::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, 'type' => $this->type]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'user', $this->user])->andFilterWhere(['like', 'userdepart', $this->userdepart])->andFilterWhere(['like', 'createtime', $this->createtime])->andFilterWhere(['like', 'begindate', $this->begindate])->andFilterWhere(['like', 'enddate', $this->enddate])->andFilterWhere(['like', 'handledepart', $this->handledepart])->andFilterWhere(['like', 'state', $this->state]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getReqform0() { return $this->hasOne(Reqform::className(), ['id' => 'reqform']); }
/** * Finds the Reqform model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Reqform the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Reqform::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }