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 MailPoet\Doctrine\EntityTraits\UpdatedAtTrait;
|
||||
use MailPoetVendor\Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
@@ -15,6 +16,7 @@ class StatisticsWooCommercePurchaseEntity {
|
||||
use AutoincrementedIdTrait;
|
||||
use CreatedAtTrait;
|
||||
use UpdatedAtTrait;
|
||||
use SafeToOneAssociationLoadTrait;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="MailPoet\Entities\NewsletterEntity")
|
||||
@@ -70,4 +72,36 @@ class StatisticsWooCommercePurchaseEntity {
|
||||
$this->orderCurrency = $orderCurrency;
|
||||
$this->orderPriceTotal = $orderPriceTotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return NewsletterEntity
|
||||
*/
|
||||
public function getNewsletter() {
|
||||
$this->safelyLoadToOneAssociation('newsletter');
|
||||
return $this->newsletter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SendingQueueEntity
|
||||
*/
|
||||
public function getQueue() {
|
||||
$this->safelyLoadToOneAssociation('queue');
|
||||
return $this->queue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SubscriberEntity|null
|
||||
*/
|
||||
public function getSubscriber() {
|
||||
$this->safelyLoadToOneAssociation('subscriber');
|
||||
return $this->subscriber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return StatisticsClickEntity
|
||||
*/
|
||||
public function getClick() {
|
||||
$this->safelyLoadToOneAssociation('click');
|
||||
return $this->click;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user