@@ -26,7 +26,7 @@ class TaskExecutionRepository extends EntityRepository implements TaskExecutionR
2626 /**
2727 * {@inheritdoc}
2828 */
29- public function create (TaskInterface $ task , \DateTime $ scheduleTime )
29+ public function create (TaskInterface $ task , \DateTimeImmutable $ scheduleTime )
3030 {
3131 return new TaskExecution ($ task , $ task ->getHandlerClass (), $ scheduleTime , $ task ->getWorkload ());
3232 }
@@ -36,8 +36,8 @@ public function create(TaskInterface $task, \DateTime $scheduleTime)
3636 */
3737 public function save (TaskExecutionInterface $ execution )
3838 {
39- $ this ->_em ->persist ($ execution );
40- $ this ->_em ->flush ($ execution );
39+ $ this ->getEntityManager () ->persist ($ execution );
40+ $ this ->getEntityManager () ->flush ($ execution );
4141
4242 return $ this ;
4343 }
@@ -47,16 +47,16 @@ public function save(TaskExecutionInterface $execution)
4747 */
4848 public function remove (TaskExecutionInterface $ execution )
4949 {
50- $ this ->_em ->remove ($ execution );
51- $ this ->_em ->flush ($ execution );
50+ $ this ->getEntityManager () ->remove ($ execution );
51+ $ this ->getEntityManager () ->flush ($ execution );
5252
5353 return $ this ;
5454 }
5555
5656 /**
5757 * {@inheritdoc}
5858 */
59- public function findAll ( $ page = 1 , $ pageSize = null )
59+ public function findAllPaginated ( int $ page = 1 , ? int $ pageSize = null ): array
6060 {
6161 $ query = $ this ->createQueryBuilder ('e ' )
6262 ->innerJoin ('e.task ' , 't ' )
@@ -129,13 +129,13 @@ public function findByTaskUuid($taskUuid)
129129 /**
130130 * {@inheritdoc}
131131 */
132- public function findNextScheduled (\DateTime $ dateTime = null , array $ skippedExecutions = [])
132+ public function findNextScheduled (\DateTimeImmutable $ dateTime = null , array $ skippedExecutions = [])
133133 {
134134 $ queryBuilder = $ this ->createQueryBuilder ('e ' )
135135 ->innerJoin ('e.task ' , 't ' )
136136 ->where ('e.status = :status ' )
137137 ->andWhere ('e.scheduleTime < :date ' )
138- ->setParameter ('date ' , $ dateTime ?: new \DateTime ())
138+ ->setParameter ('date ' , $ dateTime ?: new \DateTimeImmutable ())
139139 ->setParameter ('status ' , TaskStatus::PLANNED )
140140 ->setMaxResults (1 );
141141
0 commit comments