Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Equivalence::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(['equivalence_id' => $this->equivalence_id, 'school_school_id' => $this->school_school_id, 'equivalence_numerical_grade' => $this->equivalence_numerical_grade, 'equivalence_percentile_lower' => $this->equivalence_percentile_lower, 'equivalence_percentile_upper' => $this->equivalence_percentile_upper]);
     $query->andFilterWhere(['like', 'equivalence_letter_grade', $this->equivalence_letter_grade])->andFilterWhere(['like', 'equivalence_school_rating', $this->equivalence_school_rating])->andFilterWhere(['like', 'equivalence_foundation_rating', $this->equivalence_foundation_rating]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEquivalences()
 {
     return $this->hasMany(Equivalence::className(), ['school_school_id' => 'school_id']);
 }
 /**
  * Finds the Equivalence model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Equivalence the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Equivalence::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }