| Conditions | 1 |
| Paths | 1 |
| Total Lines | 21 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public function init() |
||
| 31 | { |
||
| 32 | // Create Select |
||
| 33 | $select = new Select(); |
||
| 34 | $select->select('u.*, GROUP_CONCAT( ar.`name` SEPARATOR ", " ) AS rolesList') |
||
| 35 | ->from('users', 'u') |
||
| 36 | ->leftJoin('u', 'acl_users_roles', 'aur', 'u.`id` = aur.`userId`') |
||
| 37 | ->leftJoin('aur', 'acl_roles', 'ar', 'ar.`id` = aur.`roleId`') |
||
| 38 | ->groupBy('u.id'); |
||
| 39 | |||
| 40 | |||
| 41 | // Setup adapter |
||
| 42 | $adapter = new SelectSource(); |
||
| 43 | $adapter->setSource($select); |
||
| 44 | |||
| 45 | $this->setAdapter($adapter); |
||
| 46 | $this->setDefaultLimit(25); |
||
| 47 | $this->setAllowOrders(['login', 'email', 'status', 'id']); |
||
| 48 | $this->setAllowFilters(['login', 'email', 'status', 'id', 'roleId']); |
||
| 49 | return $this; |
||
| 50 | } |
||
| 51 | } |
||
| 52 |