예제 #1
0
 public function search($params)
 {
     $query = Film::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['film_id' => $this->film_id, 'release_year' => $this->release_year, 'language_id' => $this->language_id, 'original_language_id' => $this->original_language_id, 'rental_duration' => $this->rental_duration, 'rental_rate' => $this->rental_rate, 'length' => $this->length, 'replacement_cost' => $this->replacement_cost, 'last_update' => $this->last_update]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'rating', $this->rating])->andFilterWhere(['like', 'special_features', $this->special_features]);
     return $dataProvider;
 }
 /**
  * Finds the Film model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Film the loaded model
  * @throws HttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Film::findOne($id)) !== null) {
         return $model;
     } else {
         throw new HttpException(404, 'The requested page does not exist.');
     }
 }