Blame view

common/modules/rubrication/models/TaxOptionSearch.php 1.94 KB
d8c1a2e0   Yarik   Big commit artbox
1
2
3
4
  <?php

  

  namespace common\modules\rubrication\models;

  

d8c1a2e0   Yarik   Big commit artbox
5
6
  use yii\base\Model;

  use yii\data\ActiveDataProvider;

d8c1a2e0   Yarik   Big commit artbox
7
8
9
10
11
12
  

  /**

   * TaxOptionSearch represents the model behind the search form about `common\modules\rubrication\models\TaxOption`.

   */

  class TaxOptionSearch extends TaxOption

  {

d55d2fe0   Yarik   Multilanguage
13
14
15
16
17
18
19
20
21
22
      

      public function behaviors()

      {

          $behaviors = parent::behaviors();

          if(isset($behaviors['language'])) {

              unset($behaviors['language']);

          }

          return $behaviors;

      }

      

d8c1a2e0   Yarik   Big commit artbox
23
24
25
26
27
28
29
      /**

       * @inheritdoc

       */

      public function rules()

      {

          return [

              [['tax_option_id', 'tax_group_id', 'parent_id', 'sort'], 'integer'],

d8c1a2e0   Yarik   Big commit artbox
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
          ];

      }

  

      /**

       * @inheritdoc

       */

      public function scenarios()

      {

          // bypass scenarios() implementation in the parent class

          return Model::scenarios();

      }

  

      /**

       * Creates data provider instance with search query applied

       *

       * @param array $params

       *

       * @return ActiveDataProvider

       */

      public function search($params)

      {

          $query = TaxOption::find();

          // add conditions that should always apply here

          if (!empty($params['group'])) {

              $this->tax_group_id = intval($params['group']);

              unset($params['group']);

          }

  

          $dataProvider = new ActiveDataProvider([

              'query' => $query,

          ]);

  

          $this->load($params);

  

  //        if (!$this->validate()) {

  //            return $dataProvider;

  //        }

  

          // grid filtering conditions

          $query->andFilterWhere([

              'tax_option_id' => $this->tax_option_id,

              'tax_group_id' => $this->tax_group_id,

              'parent_id' => $this->parent_id,

              'sort' => $this->sort,

          ]);

93c267f7   Yarik   Multilanguage big...
75
          

d8c1a2e0   Yarik   Big commit artbox
76
77
78
79
80
          $query->orderBy(['path_int' => SORT_ASC, 'depth' => SORT_ASC, 'sort' => SORT_ASC]);

  

          return $dataProvider;

      }

  }