94 lines
2.2 KiB
PHP
94 lines
2.2 KiB
PHP
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
|
|
|
|
namespace MailPoet\Entities;
|
|
|
|
if (!defined('ABSPATH')) exit;
|
|
|
|
|
|
use MailPoet\Doctrine\EntityTraits\AutoincrementedIdTrait;
|
|
use MailPoet\Doctrine\EntityTraits\SafeToOneAssociationLoadTrait;
|
|
use MailPoetVendor\Doctrine\ORM\Mapping as ORM;
|
|
|
|
/**
|
|
* @ORM\Entity()
|
|
* @ORM\Table(name="statistics_newsletters")
|
|
*/
|
|
class StatisticsNewsletterEntity {
|
|
use AutoincrementedIdTrait;
|
|
use SafeToOneAssociationLoadTrait;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="MailPoet\Entities\NewsletterEntity")
|
|
* @ORM\JoinColumn(name="newsletter_id", referencedColumnName="id")
|
|
* @var NewsletterEntity|null
|
|
*/
|
|
private $newsletter;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="MailPoet\Entities\SendingQueueEntity")
|
|
* @ORM\JoinColumn(name="queue_id", referencedColumnName="id")
|
|
* @var SendingQueueEntity|null
|
|
*/
|
|
private $queue;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="MailPoet\Entities\SubscriberEntity")
|
|
* @ORM\JoinColumn(name="subscriber_id", referencedColumnName="id")
|
|
* @var SubscriberEntity|null
|
|
*/
|
|
private $subscriber;
|
|
|
|
/**
|
|
* @ORM\Column(type="datetimetz", nullable=true)
|
|
* @var \DateTimeInterface|null
|
|
*/
|
|
private $sentAt;
|
|
|
|
public function __construct(
|
|
NewsletterEntity $newsletter,
|
|
SendingQueueEntity $queue,
|
|
SubscriberEntity $subscriber
|
|
) {
|
|
$this->newsletter = $newsletter;
|
|
$this->queue = $queue;
|
|
$this->subscriber = $subscriber;
|
|
}
|
|
|
|
/**
|
|
* @return NewsletterEntity|null
|
|
*/
|
|
public function getNewsletter() {
|
|
$this->safelyLoadToOneAssociation('newsletter');
|
|
return $this->newsletter;
|
|
}
|
|
|
|
/**
|
|
* @return SendingQueueEntity|null
|
|
*/
|
|
public function getQueue() {
|
|
$this->safelyLoadToOneAssociation('queue');
|
|
return $this->queue;
|
|
}
|
|
|
|
/**
|
|
* @return SubscriberEntity|null
|
|
*/
|
|
public function getSubscriber() {
|
|
$this->safelyLoadToOneAssociation('subscriber');
|
|
return $this->subscriber;
|
|
}
|
|
|
|
/**
|
|
* @return \DateTimeInterface|null
|
|
*/
|
|
public function getSentAt() {
|
|
return $this->sentAt;
|
|
}
|
|
|
|
/**
|
|
* @param \DateTimeInterface $sentAt
|
|
*/
|
|
public function setSentAt(\DateTimeInterface $sentAt) {
|
|
$this->sentAt = $sentAt;
|
|
}
|
|
}
|