Completed
Push — master ( 249002...76efa7 )
by Julito
09:55
created

GroupRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 21
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getAdmins() 0 6 1
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\UserBundle\Repository;
5
6
use Doctrine\ORM\EntityManagerInterface;
7
use Doctrine\ORM\EntityRepository;
8
use FOS\UserBundle\Model\Group;
9
10
/**
11
 * Class GroupRepository.
12
 *
13
 * @package Entity\Repository
14
 */
15
class GroupRepository
16
{
17
    /**
18
     * @var EntityRepository
19
     */
20
    private $repository;
21
22
    public function __construct(EntityManagerInterface $entityManager)
23
    {
24
        $this->repository = $entityManager->getRepository(Group::class);
25
    }
26
27
    /**
28
     * @return mixed
29
     */
30
    public function getAdmins()
31
    {
32
        $criteria = ['name' => 'admins'];
33
        $group = $this->repository->findOneBy($criteria);
34
35
        return $group->getUsers();
36
    }
37
}
38