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

GroupRepository::getAdmins()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
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