Skip to content

Commit ca22c35

Browse files
improved interface for storage
1 parent 4541089 commit ca22c35

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Entity/TaskExecutionRepository.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,15 @@ public function findByTaskUuid($taskUuid)
129129
/**
130130
* {@inheritdoc}
131131
*/
132-
public function findScheduled()
132+
public function findNextScheduled(\DateTime $dateTime = null)
133133
{
134134
$query = $this->createQueryBuilder('e')
135135
->innerJoin('e.task', 't')
136136
->where('e.status = :status')
137137
->andWhere('e.scheduleTime < :date')
138-
->setParameter('date', new \DateTime())
138+
->setParameter('date', $dateTime ?: new \DateTime())
139139
->setParameter('status', TaskStatus::PLANNED)
140+
->setMaxResults(1)
140141
->getQuery();
141142

142143
return $query->getResult();

0 commit comments

Comments
 (0)