Simplify fetching a single result from database

[MAILPOET-2439]
This commit is contained in:
Pavel Dohnal
2019-10-29 15:34:17 +01:00
committed by Jack Kitterhing
parent 20ad724a98
commit ac9761228a
2 changed files with 3 additions and 9 deletions

View File

@ -102,11 +102,7 @@ class Worker {
private function constructNewsletter(StatsNotificationEntity $stats_notification_entity) {
$newsletter = $stats_notification_entity->getNewsletter();
try {
$link = $this->newsletter_link_repository->findTopLinkForNewsletter($newsletter->getId());
} catch (\MailPoetVendor\Doctrine\ORM\UnexpectedResultException $e) {
$link = null;
}
$link = $this->newsletter_link_repository->findTopLinkForNewsletter($newsletter->getId());
$context = $this->prepareContext($newsletter, $link);
$subject = $newsletter->getLatestQueue()->getNewsletterRenderedSubject();
return [