public function searchAssessment($params) { $query = AssessmentForm::find(); $pageSize = Yii::$app->params['pageSize']; $dataProvider->sort->attributes['id'] = ['asc' => ['id' => SORT_ASC], 'desc' => ['id' => SORT_DESC]]; $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]], 'pagination' => ['pageSize' => $pageSize]]); $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, 'enrolled_id' => $this->enrolled_id, 'tuition_id' => $this->tuition_id, 'sibling_discount' => $this->sibling_discount, 'sibling_percentage_value' => $this->percentage_value, 'book_discount' => $this->book_discount, 'honor_discount' => $this->honor_discount, 'total_assessed' => $this->total_assessed, 'balance' => $this->balance, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); return $dataProvider; }
protected function findAssessment($id) { $model = AssessmentForm::find()->where(['enrolled_id' => $id])->all(); if (!empty($model)) { return $model; } else { return null; } }
public function getAssessment() { return $this->hasOne(AssessmentForm::className(), ['id' => 'assessment_id']); }
protected function findAssessment($id) { if (($model = AssessmentForm::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }