SectorRepository::getSectorsOrderedyName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Api\Entity;
4
5
use Doctrine\ORM\EntityRepository;
6
7
class SectorRepository extends EntityRepository
8
{
9 2
    public function getSector($sector)
10
    {
11 2
        $dql = 'SELECT s FROM Api\Entity\Sector s WHERE s.id = :sector';
12
13 2
        return $this->getEntityManager()->createQuery($dql)
14 2
            ->setParameter('sector', $sector)
15 2
            ->getArrayResult();
16
    }
17
18 2
    public function getSectorsOrderedyName()
19
    {
20 2
        $dql = 'SELECT s.name, s.color FROM Api\Entity\Sector s ORDER BY s.name';
21
22 2
        return $this->getEntityManager()->createQuery($dql)
23 2
            ->getArrayResult();
24
    }
25
}
26