Passed
Push — master ( d88203...94a809 )
by Julito
07:42
created

AccessUrlRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFirstId() 0 7 1
A __construct() 0 3 1
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CoreBundle\Repository\Node;
6
7
use Chamilo\CoreBundle\Entity\AccessUrl;
8
use Chamilo\CoreBundle\Repository\ResourceRepository;
9
use Doctrine\Persistence\ManagerRegistry;
10
11
/**
12
 * Class AccessUrlRepository.
13
 */
14
class AccessUrlRepository extends ResourceRepository
15
{
16
    public function __construct(ManagerRegistry $registry)
17
    {
18
        parent::__construct($registry, AccessUrl::class);
19
    }
20
21
    /**
22
     * Select the first access_url ID in the list as a default setting for
23
     * the creation of new users.
24
     */
25
    public function getFirstId()
26
    {
27
        $qb = $this->getRepository()->createQueryBuilder('a');
28
        $qb->select('MIN (a.id)');
29
        $q = $qb->getQuery();
30
31
        return $q->execute();
32
    }
33
}
34