Conditions | 3 |
Paths | 4 |
Total Lines | 25 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 3.1406 |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
14 | public function findByDateRangeAndSlug( |
||
15 | \DateTime $fromDate, |
||
16 | 2 | \DateTime $toDate, |
|
17 | $limit = 'all', |
||
18 | $performanceSlug = null |
||
19 | ) { |
||
20 | 2 | $qb = $this->createQueryBuilder('u') |
|
21 | ->WHERE('u.dateTime BETWEEN :from AND :to') |
||
22 | 2 | ->setParameter('from', $fromDate->format('Y-m-d H:i')) |
|
23 | ->setParameter('to', $toDate->format('Y-m-d H:i')) |
||
24 | ->orderBy('u.dateTime', 'ASC') |
||
25 | ; |
||
26 | |||
27 | if ('all' !== $limit) { |
||
28 | $qb->setMaxResults($limit); |
||
29 | } |
||
30 | |||
31 | if ($performanceSlug) { |
||
32 | $qb->join('u.performance', 'p')->andWhere('p.slug = :slug')->setParameter('slug', $performanceSlug); |
||
33 | } |
||
34 | |||
35 | $query = $qb->getQuery(); |
||
36 | |||
37 | return $query->execute(); |
||
38 | } |
||
39 | } |
||
40 |