BadgeRepository::countAll()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace Badger\Bundle\GameBundle\Doctrine\Repository;
4
5
use Badger\Component\Game\Repository\BadgeRepositoryInterface;
6
use Doctrine\ORM\EntityRepository;
7
8
/**
9
 * Doctrine implementation of repository for Badge entities.
10
 *
11
 * @author  Adrien Pétremann <[email protected]>
12
 * @license http://opensource.org/licenses/MIT The MIT License (MIT)
13
 */
14
class BadgeRepository extends EntityRepository implements BadgeRepositoryInterface
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function countAll()
20
    {
21
        $qb = $this->getEntityManager()->createQueryBuilder();
22
        $qb->select($qb->expr()->count('b'))
23
            ->from('GameBundle:Badge', 'b');
24
25
        $query = $qb->getQuery();
26
27
        return $query->getSingleScalarResult();
28
    }
29
}
30