/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = WeekdayReading::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, 'weekday_daynum' => $this->weekday_daynum, 'weekday_cycle_num' => $this->weekday_cycle_num, 'weekday_weeknum' => $this->weekday_weeknum]); $query->andFilterWhere(['like', 'weekday_name', $this->weekday_name])->andFilterWhere(['like', 'weekday_day', $this->weekday_day])->andFilterWhere(['like', 'weekday_first_reading', $this->weekday_first_reading])->andFilterWhere(['like', 'weekday_first_audio', $this->weekday_first_audio])->andFilterWhere(['like', 'weekday_alleluia_verse', $this->weekday_alleluia_verse])->andFilterWhere(['like', 'weekday_alleluia_audio', $this->weekday_alleluia_audio])->andFilterWhere(['like', 'weekday_responsorial_psalm', $this->weekday_responsorial_psalm])->andFilterWhere(['like', 'weekday_responsorial_audio', $this->weekday_responsorial_audio])->andFilterWhere(['like', 'weekday_gospel', $this->weekday_gospel])->andFilterWhere(['like', 'weekday_gospel_audio', $this->weekday_gospel_audio])->andFilterWhere(['like', 'weekday_reading_type', $this->weekday_reading_type])->andFilterWhere(['like', 'weekday_first_optional', $this->weekday_first_optional])->andFilterWhere(['like', 'weekday_responsorial_optional', $this->weekday_responsorial_optional])->andFilterWhere(['like', 'weekday_alleluia_optional', $this->weekday_alleluia_optional])->andFilterWhere(['like', 'weekday_gospel_optional', $this->weekday_gospel_optional]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getWeekdayReading() { return $this->hasOne(WeekdayReading::className(), ['id' => 'weekday_reading_id']); }
/** * Finds the WeekdayReading model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return WeekdayReading the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = WeekdayReading::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }