public function search($params) { $query = Participation::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'teamevent_id' => $this->teamevent_id, 'time_deleted' => $this->time_deleted, 'time_create' => $this->time_create]); $query->andFilterWhere(['like', 'status', $this->status]); return $dataProvider; }
/** * Finds the Participation model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Participation the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Participation::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getParticipations() { return $this->hasMany(Participation::className(), ['teamevent_id' => 'id']); }