@@ 16-27 (lines=12) @@ | ||
13 | class CronTaskRepository extends EntityRepository |
|
14 | { |
|
15 | ||
16 | public function getOneTask() |
|
17 | { |
|
18 | return $this->createQueryBuilder('ct') |
|
19 | ->where('ct.firstRun <= :currentDate') |
|
20 | ->andWhere('ct.disabled = 0') |
|
21 | ->andWhere('ct.used = 0') |
|
22 | ->setParameter('currentDate', new \DateTime('now'), \Doctrine\DBAL\Types\Type::DATETIME) |
|
23 | ->orderBy('ct.firstRun') |
|
24 | ->setMaxResults(1) |
|
25 | ->getQuery() |
|
26 | ->getOneOrNullResult(); |
|
27 | } |
|
28 | ||
29 | public function getNewTasks($maxResult=10) |
|
30 | { |
|
@@ 29-40 (lines=12) @@ | ||
26 | ->getOneOrNullResult(); |
|
27 | } |
|
28 | ||
29 | public function getNewTasks($maxResult=10) |
|
30 | { |
|
31 | return $this->createQueryBuilder('ct') |
|
32 | ->where('ct.firstRun <= :currentDate') |
|
33 | ->andWhere('ct.disabled = 0') |
|
34 | ->andWhere('ct.used = 0') |
|
35 | ->setParameter('currentDate', new \DateTime('now'), \Doctrine\DBAL\Types\Type::DATETIME) |
|
36 | ->orderBy('ct.firstRun') |
|
37 | ->setMaxResults($maxResult) |
|
38 | ->getQuery() |
|
39 | ->getResult(); |
|
40 | } |
|
41 | ||
42 | } |
|
43 |