Use refreshAll() helper for batch updates

[MAILPOET-5845]
This commit is contained in:
Jan Jakes
2024-01-18 17:59:06 +01:00
committed by Aschepikov
parent d6da2af55b
commit a947dd36cd
3 changed files with 26 additions and 2 deletions

View File

@@ -94,6 +94,11 @@ class ScheduledTaskSubscribersRepository extends Repository {
->setParameter('task', $task)
->getQuery()
->execute();
// update was done via DQL, make sure the entities are also refreshed in the entity manager
$this->refreshAll(function (ScheduledTaskSubscriberEntity $entity) use ($task, $subscriberIds) {
return $entity->getTask() === $task && in_array($entity->getSubscriberId(), $subscriberIds, true);
});
}
$this->checkCompleted($task);