Esempio n. 1
0
 public function search($params)
 {
     $query = ProductModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_product' => $this->id_product, 'id_category' => $this->id_category, 'id_group' => $this->id_group, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'cd_product', $this->cd_product])->andFilterWhere(['like', 'nm_product', $this->nm_product])->andFilterWhere(['like', 'create_at', $this->create_at])->andFilterWhere(['like', 'update_at', $this->update_at]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['nmProduct'], 'in', 'range' => Product::find()->select('nm_product')->column()], [['id_product', 'id_uom', 'isi'], 'required'], [['id_product', 'id_uom', 'isi'], 'integer'], [['id_uom'], 'unique', 'targetAttribute' => ['id_product', 'id_uom']]];
 }