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

TaskRepository   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 6
Bugs 1 Features 2
Metric Value
wmc 1
c 6
b 1
f 2
lcom 0
cbo 2
dl 0
loc 18
ccs 0
cts 8
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A findEndBefore() 0 8 1
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