Completed
Push — master ( cc2045...c73ac3 )
by Serhii
25:51 queued 25:43
created

PerformanceEventRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 90%

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 9
cts 10
cp 0.9
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A findByDateRangeAndSlug() 0 17 2
1
<?php
2
3
namespace AppBundle\Repository;
4
5
class PerformanceEventRepository extends AbstractRepository
6
{
7 2
    public function findByDateRangeAndSlug(\DateTime $fromDate, \DateTime $toDate, $performanceSlug = null)
8
    {
9 2
        $qb = $this->createQueryBuilder('u')
10 2
            ->WHERE('u.dateTime BETWEEN :from AND :to')
11 2
            ->setParameter('from', $fromDate->format('Y-m-d H:i'))
12 2
            ->setParameter('to', $toDate->format('Y-m-d H:i'))
13 2
            ->orderBy('u.dateTime', 'ASC')
14
        ;
15
16 2
        if ($performanceSlug) {
17
            $qb->join('u.performance', 'p')->andWhere('p.slug = :slug')->setParameter('slug', $performanceSlug);
18
        }
19
20 2
        $query = $qb->getQuery();
21
22 2
        return $query->execute();
23
    }
24
}
25