Conditions | 2 |
Paths | 2 |
Total Lines | 34 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
57 | public function search($params) |
||
58 | { |
||
59 | $query = Article::find()->joinWith(['articlesLanguages']); |
||
60 | |||
61 | // add conditions that should always apply here |
||
62 | |||
63 | $dataProvider = new ActiveDataProvider([ |
||
64 | 'query' => $query, |
||
65 | ]); |
||
66 | |||
67 | $this->load($params); |
||
68 | |||
69 | if (!$this->validate()) { |
||
70 | // uncomment the following line if you do not want to return any records when validation fails |
||
71 | // $query->where('0=1'); |
||
72 | return $dataProvider; |
||
73 | } |
||
74 | |||
75 | // grid filtering conditions |
||
76 | $query->andFilterWhere([ |
||
77 | 'pageId' => $this->pageId, |
||
78 | 'active' => $this->active, |
||
79 | ]); |
||
80 | |||
81 | $query->andFilterWhere(['like', 'articles_language.title', $this->title]); |
||
82 | |||
83 | $pagination = new Pagination([ |
||
84 | 'defaultPageSize' => Yii::$app->params['defaultPageSize'], |
||
85 | 'totalCount' => $query->count(), |
||
86 | ]); |
||
87 | |||
88 | $dataProvider->setPagination($pagination); |
||
89 | |||
90 | return $dataProvider; |
||
91 | } |
||
93 |