/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CharactAttr::find()->lang();
     $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(['id' => $this->id, 'categoryId' => $this->categoryId]);
     $query->andFilterWhere(['like', 'lang', $this->lang])->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
Example #2
0
 public function run()
 {
     $charactList = CharactAttr::find()->lang()->andWhere(['categoryId' => $this->model->categoryId])->position()->all();
     $charactForm = new ProductCharactForm();
     return $this->render('charactForm', ['model' => $this->model, 'charactList' => $charactList, 'charactForm' => $charactForm, 'k' => $this->k]);
 }
 public function getCharact()
 {
     return $this->hasMany(CharactAttr::className(), ['categoryId' => 'id'])->andWhere(['langauge' => \Yii::$app->language]);
 }