public function search($params)
 {
     $query = ProductSupplierModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_product' => $this->id_product, 'id_supplier' => $this->id_supplier, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'create_at', $this->create_at])->andFilterWhere(['like', 'update_at', $this->update_at]);
     return $dataProvider;
 }
 /**
  * Finds the ProductSupplier model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param  integer               $id_product
  * @param  integer               $id_supplier
  * @return ProductSupplier       the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id_product, $id_supplier)
 {
     if (($model = ProductSupplier::findOne(['id_product' => $id_product, 'id_supplier' => $id_supplier])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProductSupplier()
 {
     return $this->hasOne(ProductSupplier::className(), ['id_supplier' => 'id_supplier']);
 }