CategoryRepository::countAll()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
rs 9.6666
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace AppBundle\Entity;
4
5
use Doctrine\ORM\EntityRepository;
6
7
class CategoryRepository extends EntityRepository
8
{
9
    public function findOrderedByPosition()
10
    {
11
        return $this
12
            ->createQueryBuilder('c')
13
            ->select('c, m')
14
            ->leftJoin('c.meals', 'm')
15
            ->orderBy('c.position', 'ASC')
16
            ->addOrderBy('m.position', 'ASC')
17
            ->getQuery()
18
            ->getResult()
19
        ;
20
    }
21
22
    public function countAll()
23
    {
24
        return $this
25
            ->createQueryBuilder('c')
26
            ->select('COUNT(c.id)')
27
            ->getQuery()
28
            ->getSingleScalarResult()
29
        ;
30
    }
31
}
32