/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $languageId = [1, 68];
     $query = PhraseMaster::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(['Phrase_ID' => $this->Phrase_ID, 'Language_ID' => $languageId, 'Surah_Number' => $this->Surah_Number, 'Phrase_Number' => $this->Phrase_Number]);
     $query->andFilterWhere(['like', 'Phrase_Content', $this->Phrase_Content]);
     $query->orderBy('Surah_Number, Phrase_Number');
     return $dataProvider;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPhraseMasters()
 {
     return $this->hasMany(PhraseMaster::className(), ['Surah_Number' => 'Surah_Number']);
 }
 /**
  * Finds the PhraseMaster model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return PhraseMaster the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = PhraseMaster::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }