/**
  * Displays a single Product model.
  * @param integer $id
  * @return mixed
  */
 public function actionView($id)
 {
     $ingredients = new ActiveDataProvider(['query' => Ingredients::find()->where(['product_id' => $id, 'status' => [Status::STATUS_ACTIVE]])]);
     $productReviews = new ActiveDataProvider(['query' => \common\models\ProductReview::find()->where(['product_id' => $id, 'status' => [Status::STATUS_ACTIVE]])]);
     $productPhotos = new ActiveDataProvider(['query' => ProductPhoto::find()->where(['product_id' => $id, 'status' => [Status::STATUS_ACTIVE]])]);
     return $this->render('view', ['model' => $this->findModel($id), 'ingredients' => $ingredients, 'productReviews' => $productReviews, 'productPhotos' => $productPhotos]);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ProductReview::find();
     $dataProvider = new ActiveDataProvider(['query' => $query->where(['status' => [Status::STATUS_ACTIVE, Status::STATUS_INACTIVE]])]);
     $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, 'stars' => $this->stars, 'product_id' => $this->product_id, 'user_id' => $this->user_id, 'sn_review_id' => $this->sn_review_id, 'created_date' => $this->created_date, 'modified_date' => $this->modified_date, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'created_by', $this->created_by])->andFilterWhere(['like', 'modified_by', $this->modified_by]);
     return $dataProvider;
 }