/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = SundayReading::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'sunday_weeknum' => $this->sunday_weeknum]);
     $query->andFilterWhere(['like', 'sunday_name', $this->sunday_name])->andFilterWhere(['like', 'sunday_first_reading', $this->sunday_first_reading])->andFilterWhere(['like', 'sunday_first_audio', $this->sunday_first_audio])->andFilterWhere(['like', 'sunday_second_reading', $this->sunday_second_reading])->andFilterWhere(['like', 'sunday_second_audio', $this->sunday_second_audio])->andFilterWhere(['like', 'sunday_alleluia_verse', $this->sunday_alleluia_verse])->andFilterWhere(['like', 'sunday_alleluia_audio', $this->sunday_alleluia_audio])->andFilterWhere(['like', 'sunday_responsorial_psalm', $this->sunday_responsorial_psalm])->andFilterWhere(['like', 'sunday_responsorial_audio', $this->sunday_responsorial_audio])->andFilterWhere(['like', 'sunday_gospel', $this->sunday_gospel])->andFilterWhere(['like', 'sunday_gospel_audio', $this->sunday_gospel_audio])->andFilterWhere(['like', 'sunday_before_gospel', $this->sunday_before_gospel])->andFilterWhere(['like', 'sunday_before_gospel_audio', $this->sunday_before_gospel_audio])->andFilterWhere(['like', 'sunday_cycle_type', $this->sunday_cycle_type])->andFilterWhere(['like', 'sunday_reading_type', $this->sunday_reading_type])->andFilterWhere(['like', 'sunday_description', $this->sunday_description])->andFilterWhere(['like', 'sunday_first_optional', $this->sunday_first_optional])->andFilterWhere(['like', 'sunday_second_optional', $this->sunday_second_optional])->andFilterWhere(['like', 'sunday_responsorial_optional', $this->sunday_responsorial_optional])->andFilterWhere(['like', 'sunday_alleluia_optional', $this->sunday_alleluia_optional])->andFilterWhere(['like', 'sunday_gospel_optional', $this->sunday_gospel_optional])->andFilterWhere(['like', 'sunday_before_gospel_optional', $this->sunday_before_gospel_optional]);
     return $dataProvider;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSundayReading()
 {
     return $this->hasOne(SundayReading::className(), ['id' => 'sunday_reading_id']);
 }
 /**
  * Finds the SundayReading model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return SundayReading the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = SundayReading::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }