Change SimpleWorker::prepareTaskStrategy() to use Doctrine

This commit changes the method prepareTaskStrategy() in the class
SimpleWorker and all its child classes to use ScheduledTaskEntity
instead of ScheduledTask.

[MAILPOET-2996]
This commit is contained in:
Rodrigo Primo
2021-09-28 16:12:59 -03:00
committed by Veljko V
parent 7d87b042e8
commit 57c80ea763
9 changed files with 90 additions and 63 deletions

View File

@@ -191,4 +191,16 @@ class ScheduledTask extends Model {
return $query->findMany();
}
// temporary function to convert an ScheduledTaskEntity object to ScheduledTask while we don't migrate the rest of
// the code in this class to use Doctrine entities
public static function getFromDoctrineEntity(ScheduledTaskEntity $doctrineTask): ?ScheduledTask {
$parisTask = self::findOne($doctrineTask->getId());
if (!$parisTask instanceof ScheduledTask) {
return null;
}
return $parisTask;
}
}