Completed
Pull Request — master (#15)
by Wachter
06:01
created

TaskRepository::findByUuid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 2
Metric Value
cc 1
eloc 6
c 2
b 0
f 2
nc 1
nop 1
dl 0
loc 9
ccs 6
cts 6
cp 1
crap 1
rs 9.6666
1
<?php
2
3
/*
4
 * This file is part of php-task library.
5
 *
6
 * (c) php-task
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Task\TaskBundle\Entity;
13
14
use Doctrine\ORM\EntityRepository;
15
use Task\TaskInterface;
16
17
/**
18
 * Repository for task.
19
 */
20
class TaskRepository extends EntityRepository
21
{
22
    /**
23
     * Returns task where last-execution is before given date-time.
24
     *
25
     * @param \DateTime $dateTime
26
     *
27
     * @return TaskInterface[]
28
     */
29
    public function findEndBefore(\DateTime $dateTime)
30
    {
31
        return $this->createQueryBuilder('t')
32
            ->where('t.lastExecution IS NULL OR t.lastExecution >= :dateTime')
33
            ->setParameter('dateTime', $dateTime)
34
            ->getQuery()
35
            ->getResult();
36
    }
37
}
38