/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Styles::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(['style_id' => $this->style_id, 'item_id' => $this->item_id]);
     return $dataProvider;
 }
 /**
  * Finds the Styles model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $style_id
  * @param integer $item_id
  * @return Styles the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($style_id, $item_id)
 {
     if (($model = Styles::findOne(['style_id' => $style_id, 'item_id' => $item_id])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStyle()
 {
     return $this->hasOne(Styles::className(), ['style_id' => 'style_id']);
 }