Mark all toOne associations in Stats Notification nullable

[MAILPOET-2818]
This commit is contained in:
Rostislav Wolny
2020-04-07 09:48:15 +02:00
committed by Veljko V
parent 5b457a1693
commit bbde4b1c1c
2 changed files with 12 additions and 5 deletions

View File

@ -100,7 +100,11 @@ class Worker {
throw $e;
}
} finally {
$this->markTaskAsFinished($statsNotificationEntity->getTask());
$task = $statsNotificationEntity->getTask();
if ($task instanceof ScheduledTask) {
$this->markTaskAsFinished($task);
}
}
$this->cronHelper->enforceExecutionLimit($timer);
}
@ -108,6 +112,9 @@ class Worker {
private function constructNewsletter(StatsNotificationEntity $statsNotificationEntity) {
$newsletter = $statsNotificationEntity->getNewsletter();
if (!$newsletter instanceof NewsletterEntity) {
throw new \RuntimeException('Missing newsletter entity for statistic notification.');
}
$link = $this->newsletterLinkRepository->findTopLinkForNewsletter((int)$newsletter->getId());
$context = $this->prepareContext($newsletter, $link);
$subject = $newsletter->getLatestQueue()->getNewsletterRenderedSubject();