| Total Complexity | 7 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class ArticleController extends ActiveController |
||
| 8 | { |
||
| 9 | public $modelClass = Article::class; |
||
| 10 | |||
| 11 | public function getQuery($action) |
||
| 12 | { |
||
| 13 | return parent::getQuery($action) |
||
| 14 | ->alias('a') |
||
| 15 | ->orderBy([ |
||
| 16 | 'a.id' => SORT_DESC |
||
| 17 | ]) |
||
| 18 | ->andWhere([ |
||
| 19 | 'a.is_deleted' => 0, |
||
| 20 | ]); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function searchModel() |
||
| 24 | { |
||
| 25 | return (new DynamicModel(['id' => '', 'title' => '', 'author' => '', 'summary' => '', 'status' => ''])) |
||
| 26 | ->addRule(['title', 'author', 'summary'], 'string') |
||
| 27 | ->addRule(['id', 'status'], 'number'); |
||
| 28 | } |
||
| 29 | |||
| 30 | protected function applyFilter($query, $model, $filter) |
||
| 40 | } |
||
| 41 | } |
||
| 42 | } |
||
| 44 |