Apply safe to load association trait to all toOne associations
[MAILPOET-2818]
This commit is contained in:
committed by
Veljko V
parent
217b9194db
commit
63a2bed8bf
@@ -4,6 +4,7 @@ namespace MailPoet\Entities;
|
||||
|
||||
use MailPoet\Doctrine\EntityTraits\AutoincrementedIdTrait;
|
||||
use MailPoet\Doctrine\EntityTraits\CreatedAtTrait;
|
||||
use MailPoet\Doctrine\EntityTraits\SafeToOneAssociationLoadTrait;
|
||||
use MailPoetVendor\Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
@@ -13,6 +14,7 @@ use MailPoetVendor\Doctrine\ORM\Mapping as ORM;
|
||||
class StatisticsOpenEntity {
|
||||
use AutoincrementedIdTrait;
|
||||
use CreatedAtTrait;
|
||||
use SafeToOneAssociationLoadTrait;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="MailPoet\Entities\NewsletterEntity")
|
||||
@@ -34,4 +36,19 @@ class StatisticsOpenEntity {
|
||||
*/
|
||||
private $subscriberId;
|
||||
|
||||
/**
|
||||
* @return NewsletterEntity|null
|
||||
*/
|
||||
public function getNewsletter() {
|
||||
$this->safelyLoadToOneAssociation('newsletter');
|
||||
return $this->newsletter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SendingQueueEntity|null
|
||||
*/
|
||||
public function getQueue() {
|
||||
$this->safelyLoadToOneAssociation('queue');
|
||||
return $this->queue;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user