Mark all toOne associations in Stats Notification nullable
[MAILPOET-2818]
This commit is contained in:
committed by
Veljko V
parent
5b457a1693
commit
bbde4b1c1c
@ -100,7 +100,11 @@ class Worker {
|
|||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
$this->markTaskAsFinished($statsNotificationEntity->getTask());
|
$task = $statsNotificationEntity->getTask();
|
||||||
|
if ($task instanceof ScheduledTask) {
|
||||||
|
$this->markTaskAsFinished($task);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->cronHelper->enforceExecutionLimit($timer);
|
$this->cronHelper->enforceExecutionLimit($timer);
|
||||||
}
|
}
|
||||||
@ -108,6 +112,9 @@ class Worker {
|
|||||||
|
|
||||||
private function constructNewsletter(StatsNotificationEntity $statsNotificationEntity) {
|
private function constructNewsletter(StatsNotificationEntity $statsNotificationEntity) {
|
||||||
$newsletter = $statsNotificationEntity->getNewsletter();
|
$newsletter = $statsNotificationEntity->getNewsletter();
|
||||||
|
if (!$newsletter instanceof NewsletterEntity) {
|
||||||
|
throw new \RuntimeException('Missing newsletter entity for statistic notification.');
|
||||||
|
}
|
||||||
$link = $this->newsletterLinkRepository->findTopLinkForNewsletter((int)$newsletter->getId());
|
$link = $this->newsletterLinkRepository->findTopLinkForNewsletter((int)$newsletter->getId());
|
||||||
$context = $this->prepareContext($newsletter, $link);
|
$context = $this->prepareContext($newsletter, $link);
|
||||||
$subject = $newsletter->getLatestQueue()->getNewsletterRenderedSubject();
|
$subject = $newsletter->getLatestQueue()->getNewsletterRenderedSubject();
|
||||||
|
@ -20,13 +20,13 @@ class StatsNotificationEntity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToOne(targetEntity="MailPoet\Entities\NewsletterEntity")
|
* @ORM\OneToOne(targetEntity="MailPoet\Entities\NewsletterEntity")
|
||||||
* @var NewsletterEntity
|
* @var NewsletterEntity|null
|
||||||
*/
|
*/
|
||||||
private $newsletter;
|
private $newsletter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToOne(targetEntity="MailPoet\Entities\ScheduledTaskEntity")
|
* @ORM\OneToOne(targetEntity="MailPoet\Entities\ScheduledTaskEntity")
|
||||||
* @var ScheduledTaskEntity
|
* @var ScheduledTaskEntity|null
|
||||||
*/
|
*/
|
||||||
private $task;
|
private $task;
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ class StatsNotificationEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return NewsletterEntity
|
* @return NewsletterEntity|null
|
||||||
*/
|
*/
|
||||||
public function getNewsletter() {
|
public function getNewsletter() {
|
||||||
$this->safelyLoadToOneAssociation('newsletter');
|
$this->safelyLoadToOneAssociation('newsletter');
|
||||||
@ -44,7 +44,7 @@ class StatsNotificationEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ScheduledTaskEntity
|
* @return ScheduledTaskEntity|null
|
||||||
*/
|
*/
|
||||||
public function getTask() {
|
public function getTask() {
|
||||||
$this->safelyLoadToOneAssociation('task');
|
$this->safelyLoadToOneAssociation('task');
|
||||||
|
Reference in New Issue
Block a user