UserRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 0 Features 4
Metric Value
wmc 3
c 5
b 0
f 4
lcom 1
cbo 2
dl 0
loc 31
ccs 19
cts 19
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A findUsersWithoutRole() 0 9 1
A findChoiceModules() 0 8 1
A findCountUsers() 0 9 1
1
<?php
2
3
namespace AppBundle\Repository;
4
use AppBundle\Entity\User;
5
6
/**
7
 * UserRepository
8
 *
9
 * This class was generated by the Doctrine ORM. Add your own custom
10
 * repository methods below.
11
 */
12
class UserRepository extends \Doctrine\ORM\EntityRepository
13
{
14 1
    public function findUsersWithoutRole($role)
15
    {
16 1
        return $this->createQueryBuilder('user')
17 1
            ->andWhere('user.role <> :role')
18 1
            ->setParameter('role', $role)
19 1
            ->getQuery()
20
         //   ->getResult()
21 1
            ;
22
    }
23
24 1
    public function findChoiceModules($module)
25
    {
26 1
        return $this->createQueryBuilder('u')
27 1
            ->where('u.chosenModule LIKE :module')
28 1
            ->setParameter('module', '%"'.$module.'"%')
29 1
            ->getQuery()
30 1
            ->getResult();
31
    }
32
33 1
    public function findCountUsers()
34
    {
35 1
        return $this->createQueryBuilder('u')
36 1
            ->select('COUNT(u.id) as count_u')
37 1
            ->andWhere('u.role = :role')
38 1
            ->setParameter('role', User::ROLE_USER)
39 1
            ->getQuery()
40 1
            ->getOneOrNullResult();
41
    }
42
}
43