/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MovieGenre::find()->where('status=0');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['Id' => $this->Id, 'status' => $this->status, 'createdOn' => $this->createdOn, 'updatedOn' => $this->updatedOn, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'ip', $this->ip]);
     return $dataProvider;
 }
Esempio n. 2
0
 public static function getGenreById($name)
 {
     // to return a single customer whose ID is 1:
     $movieGenre = MovieGenre::find()->where(['name' => $name])->one();
     return $movieGenre;
 }
Esempio n. 3
0
    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'launguageId')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\MovieLanguage::find()->andWhere(['status' => 1])->All(), 'Id', 'name')));
?>
 

    <?php 
echo $form->field($model, 'genres')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\MovieGenre::find()->andWhere(['status' => 1])->All(), 'Id', 'name')), ['multiple' => 'multiple', 'size' => 5]);
?>
 
    <?php 
// Usage with model and Active Form (with no default initial value)
echo $form->field($model, 'releaseDate')->widget(DatePicker::classname(), ['options' => ['placeholder' => 'Enter Release Date ...'], 'pluginOptions' => ['format' => 'yyyy-mm-dd', 'autoclose' => true]]);
?>
    <?php 
// $form->field($model, 'releaseDate')->textInput()
?>

    <?php 
// $form->field($model, 'shortCode')->textInput(['maxlength' => 30])
?>

    <?php 
 /**
  * Finds the MovieGenre model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return MovieGenre the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = MovieGenre::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }