Completed
Push — master ( 76efa7...03cf40 )
by Julito
12:18
created

GroupRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 26
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getAdmins() 0 6 1
A findOneBy() 0 3 1
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\UserBundle\Repository;
5
6
use Chamilo\UserBundle\Entity\Group;
7
use Doctrine\ORM\EntityManagerInterface;
8
use Doctrine\ORM\EntityRepository;
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
    public function findOneBy(array $criteria)
39
    {
40
        return $this->repository->findOneBy($criteria);
41
    }
42
}
43