/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Manufacturers::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['ID' => $this->ID]);
     $query->andFilterWhere(['like', 'Manufacturer', $this->Manufacturer]);
     return $dataProvider;
 }
Example #2
0
/* @var $form yii\widgets\ActiveForm */
$params = isset($id) ? ['id' => $id] : null;
?>

<div class="products-form">
    
    <?php 
$form = ActiveForm::begin(['action' => $model->isNewRecord ? Url::to(['products/create', 'id' => isset($id) ? $id : null, 'did' => isset($did) ? $did : null]) : Url::to(['products/update', 'id' => $model->ID])]);
?>

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

    <?php 
echo $form->field($model, 'Manufacturer')->dropDownList(ArrayHelper::map(Manufacturers::find()->asArray()->all(), 'ID', 'Manufacturer'), ['prompt' => Yii::t('app', 'Select...')]);
?>

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

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

    <?php 
echo $form->field($model, 'Measure')->textInput();
?>

    <?php