/**
 * Creates data provider instance with search query applied
 *
 * @param array $params
 *
 * @return ActiveDataProvider
 */
 public function search($params)
 {
     $query = FilmModel::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(['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;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFilms0()
 {
     return $this->hasMany(\giiant\sakila\models\Film::className(), ['original_language_id' => 'language_id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFilm()
 {
     return $this->hasOne(\giiant\sakila\models\Film::className(), ['film_id' => 'film_id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFilms()
 {
     return $this->hasMany(\giiant\sakila\models\Film::className(), ['film_id' => 'film_id'])->viaTable('film_category', ['category_id' => 'category_id']);
 }
 /**
  * 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 $film_id
  * @return Film the loaded model
  * @throws HttpException if the model cannot be found
  */
 protected function findModel($film_id)
 {
     if (($model = Film::findOne($film_id)) !== null) {
         return $model;
     } else {
         throw new HttpException(404, 'The requested page does not exist.');
     }
 }