/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ProductGroupDetail::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->joinWith(['productGroup', 'product']);
     $query->andFilterWhere(['product_group_detail_id' => $this->product_group_detail_id, 'product_qty' => $this->product_qty, 'product_ori_price' => $this->product_ori_price, 'product_group_price' => $this->product_group_price]);
     $query->andFilterWhere(['like', 'product_group_desc', $this->product_group_id])->andFilterWhere(['like', 'product_name', $this->product_id]);
     return $dataProvider;
 }
 /**
  * Finds the ProductGroupDetail model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $product_group_detail_id
  * @param integer $product_group_id
  * @param integer $product_id
  * @return ProductGroupDetail the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($product_group_detail_id, $product_group_id, $product_id)
 {
     if (($model = ProductGroupDetail::findOne(['product_group_detail_id' => $product_group_detail_id, 'product_group_id' => $product_group_id, 'product_id' => $product_id])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }