| Total Complexity | 2 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class RolePermissionRepository extends EntityRepository |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @param Permission $permission |
||
| 18 | * @return array |
||
| 19 | */ |
||
| 20 | public function getRoleIdsByPermission(Permission $permission) |
||
| 21 | { |
||
| 22 | $qb = $this->createQueryBuilder('rolePermission'); |
||
| 23 | |||
| 24 | $qb->select('rolePermission.roleId') |
||
| 25 | ->where($qb->expr()->eq('rolePermission.permissionId', $permission->getId())); |
||
| 26 | |||
| 27 | return $qb->getQuery()->getArrayResult(); |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Search RolePermission record. If found return true else false |
||
| 32 | * @param integer $permissionId |
||
| 33 | * @param integer[] $roleIds |
||
| 34 | * @return bool |
||
| 35 | */ |
||
| 36 | public function isPermissionAssigned(int $permissionId, array $roleIds): bool |
||
| 53 | } |
||
| 54 | } |
||
| 55 |