Use orphan removal for scheduled task subscriber entity
It is a connecting entity between task and subscriber, and it makes no sense to keep without either of them. This could prevent some partial-delete bugs. [MAILPOET-4375]
This commit is contained in:
@@ -95,8 +95,15 @@ class ScheduledTaskEntity {
|
|||||||
*/
|
*/
|
||||||
private $sendingQueue;
|
private $sendingQueue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity="MailPoet\Entities\ScheduledTaskSubscriberEntity", mappedBy="task", orphanRemoval=true)
|
||||||
|
* @var Collection<int, ScheduledTaskSubscriberEntity>
|
||||||
|
*/
|
||||||
|
private $scheduledTaskSubscribers;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->subscribers = new ArrayCollection();
|
$this->subscribers = new ArrayCollection();
|
||||||
|
$this->scheduledTaskSubscribers = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -45,13 +45,13 @@ class ScheduledTaskSubscriberEntity {
|
|||||||
private $error;
|
private $error;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Id @ORM\ManyToOne(targetEntity="MailPoet\Entities\ScheduledTaskEntity")
|
* @ORM\Id @ORM\ManyToOne(targetEntity="MailPoet\Entities\ScheduledTaskEntity", inversedBy="scheduledTaskSubscribers")
|
||||||
* @var ScheduledTaskEntity|null
|
* @var ScheduledTaskEntity|null
|
||||||
*/
|
*/
|
||||||
private $task;
|
private $task;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Id @ORM\ManyToOne(targetEntity="MailPoet\Entities\SubscriberEntity")
|
* @ORM\Id @ORM\ManyToOne(targetEntity="MailPoet\Entities\SubscriberEntity", inversedBy="scheduledTaskSubscribers")
|
||||||
* @var SubscriberEntity|null
|
* @var SubscriberEntity|null
|
||||||
*/
|
*/
|
||||||
private $subscriber;
|
private $subscriber;
|
||||||
|
@@ -215,10 +215,17 @@ class SubscriberEntity {
|
|||||||
*/
|
*/
|
||||||
private $subscriberTags;
|
private $subscriberTags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity="MailPoet\Entities\ScheduledTaskSubscriberEntity", mappedBy="subscriber", orphanRemoval=true)
|
||||||
|
* @var Collection<int, ScheduledTaskSubscriberEntity>
|
||||||
|
*/
|
||||||
|
private $scheduledTaskSubscribers;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->subscriberSegments = new ArrayCollection();
|
$this->subscriberSegments = new ArrayCollection();
|
||||||
$this->subscriberCustomFields = new ArrayCollection();
|
$this->subscriberCustomFields = new ArrayCollection();
|
||||||
$this->subscriberTags = new ArrayCollection();
|
$this->subscriberTags = new ArrayCollection();
|
||||||
|
$this->scheduledTaskSubscribers = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user