Sync bulk deletes of scheduled task subscribers to entity manager
Fixes: https://github.com/mailpoet/mailpoet/issues/5281 [MAILPOET-5745]
This commit is contained in:
@@ -124,6 +124,11 @@ class ScheduledTaskSubscribersRepository extends Repository {
|
||||
->setParameter('task', $scheduledTask)
|
||||
->getQuery()
|
||||
->execute();
|
||||
|
||||
// delete was done via DQL, make sure the entities are also detached from the entity manager
|
||||
$this->detachAll(function (ScheduledTaskSubscriberEntity $entity) use ($scheduledTask) {
|
||||
return $entity->getTask() === $scheduledTask;
|
||||
});
|
||||
}
|
||||
|
||||
public function deleteByScheduledTaskAndSubscriberIds(ScheduledTaskEntity $scheduledTask, array $subscriberIds): void {
|
||||
@@ -136,6 +141,11 @@ class ScheduledTaskSubscribersRepository extends Repository {
|
||||
->getQuery()
|
||||
->execute();
|
||||
|
||||
// delete was done via DQL, make sure the entities are also detached from the entity manager
|
||||
$this->detachAll(function (ScheduledTaskSubscriberEntity $entity) use ($scheduledTask, $subscriberIds) {
|
||||
return $entity->getTask() === $scheduledTask && in_array($entity->getSubscriberId(), $subscriberIds, true);
|
||||
});
|
||||
|
||||
$this->checkCompleted($scheduledTask);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user