/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Activity::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(['activity_id' => $this->activity_id, 'activity_type' => $this->activity_type, 'activity_send_type' => $this->activity_send_type, 'vaild_date' => $this->vaild_date, 'create_time' => $this->create_time, 'update_time' => $this->update_time, 'is_delete' => $this->is_delete]); $query->andFilterWhere(['like', 'activity_send_value', $this->activity_send_value]); return $dataProvider; }
/** * Finds the Activity model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Activity the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Activity::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getActivity() { return $this->hasOne(Activity::className(), ['activity_id' => 'activity_id']); }