CategoryRepository   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A countAll() 0 9 1
A findOrderedByPosition() 0 12 1
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