TicketRepository::countOpenedTickets()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Matks\Bundle\CustomerSupportBundle\Repository;
4
5
use Matks\Bundle\CustomerSupportBundle\Model\TicketInterface;
6
use Doctrine\ORM\EntityRepository;
7
8
/**
9
 * Ticket repository
10
 *
11
 * @author Mathieu Ferment <[email protected]>
12
 */
13
class TicketRepository extends EntityRepository
14
{
15
    public function countOpenedTickets()
16
    {
17
        $queryBuilder = $this->createQueryBuilder('t')
18
            ->select('COUNT(t.id)')
19
            ->where('t.status IN (:openedStatuses)')
20
            ->setParameter(':openedStatuses', [TicketInterface::STATUS_NEW, TicketInterface::STATUS_REOPENED]);
21
22
        return $queryBuilder->getQuery()->getSingleScalarResult();
23
    }
24
}
25