コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
ファイル: _form.php プロジェクト: rajanishtimes/partnerapi
    <?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 
コード例 #3
0
 public static function getGenreById($name)
 {
     // to return a single customer whose ID is 1:
     $movieGenre = MovieGenre::find()->where(['name' => $name])->one();
     return $movieGenre;
 }