/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = SolemnitiesOrFeasts::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]); $query->andFilterWhere(['like', 'date', $this->date])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'first_reading', $this->first_reading])->andFilterWhere(['like', 'first_reading_audio', $this->first_reading_audio])->andFilterWhere(['like', 'responsorial_psalm', $this->responsorial_psalm])->andFilterWhere(['like', 'responsorial_psalm_audio', $this->responsorial_psalm_audio])->andFilterWhere(['like', 'second_reading', $this->second_reading])->andFilterWhere(['like', 'second_reading_audio', $this->second_reading_audio])->andFilterWhere(['like', 'alleluia_verse', $this->alleluia_verse])->andFilterWhere(['like', 'alleluia_verse_audio', $this->alleluia_verse_audio])->andFilterWhere(['like', 'gospel', $this->gospel])->andFilterWhere(['like', 'gospel_audio', $this->gospel_audio])->andFilterWhere(['like', 'rule', $this->rule])->andFilterWhere(['like', 'cycle_type', $this->cycle_type]); return $dataProvider; }
/** * Finds the SolemnitiesOrFeasts model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return SolemnitiesOrFeasts the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = SolemnitiesOrFeasts::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }