| @@ 34-44 (lines=11) @@ | ||
| 31 | * |
|
| 32 | * @return Import |
|
| 33 | */ |
|
| 34 | public function findOneLatestStarted() |
|
| 35 | { |
|
| 36 | $builder = $this->createQueryBuilder('i') |
|
| 37 | ->andWhere('i.datetimeStarted IS NOT NULL') |
|
| 38 | ->andWhere('SIZE(i.parts) > 0') |
|
| 39 | ->orderBy('i.datetimeStarted', 'DESC') |
|
| 40 | ->setMaxResults(1) |
|
| 41 | ; |
|
| 42 | ||
| 43 | return $builder->getQuery()->getOneOrNullResult(); |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Find latest started import by feed. |
|
| @@ 110-119 (lines=10) @@ | ||
| 107 | * |
|
| 108 | * @return Import[] |
|
| 109 | */ |
|
| 110 | public function findStartedButUnfinished() |
|
| 111 | { |
|
| 112 | $builder = $this->createQueryBuilder('i') |
|
| 113 | ->andWhere('i.datetimeStarted IS NOT NULL') |
|
| 114 | ->andWhere('i.datetimeEnded IS NULL') |
|
| 115 | ->orderBy('i.datetimeStarted', 'DESC') |
|
| 116 | ; |
|
| 117 | ||
| 118 | return $builder->getQuery()->getResult(); |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * @param Import $import |
|