*/ private $subscribers; /** * @ORM\OneToOne(targetEntity="MailPoet\Entities\SendingQueueEntity", mappedBy="task", fetch="EAGER") * @var SendingQueueEntity|null */ private $sendingQueue; /** * @ORM\OneToMany(targetEntity="MailPoet\Entities\ScheduledTaskSubscriberEntity", mappedBy="task", orphanRemoval=true) * @var Collection */ private $scheduledTaskSubscribers; public function __construct() { $this->subscribers = new ArrayCollection(); $this->scheduledTaskSubscribers = new ArrayCollection(); } /** * @return string|null */ public function getType() { return $this->type; } /** * @param string|null $type */ public function setType($type) { $this->type = $type; } /** * @return string|null */ public function getStatus() { return $this->status; } /** * @param string|null $status */ public function setStatus($status) { $this->status = $status; } /** * @return int */ public function getPriority() { return $this->priority; } /** * @param int $priority */ public function setPriority($priority) { $this->priority = $priority; } /** * @return DateTimeInterface|null */ public function getScheduledAt() { return $this->scheduledAt; } /** * @param DateTimeInterface|null $scheduledAt */ public function setScheduledAt($scheduledAt) { $this->scheduledAt = $scheduledAt; } /** * @return DateTimeInterface|null */ public function getProcessedAt() { return $this->processedAt; } /** * @param DateTimeInterface|null $processedAt */ public function setProcessedAt($processedAt) { $this->processedAt = $processedAt; } /** * @return array|null */ public function getMeta() { return $this->meta; } /** * @param array|null $meta */ public function setMeta($meta) { $this->meta = $meta; } /** * @return bool|null */ public function getInProgress() { return $this->inProgress; } /** * @param bool|null $inProgress */ public function setInProgress($inProgress) { $this->inProgress = $inProgress; } public function getRescheduleCount(): int { return $this->rescheduleCount; } public function setRescheduleCount(int $rescheduleCount) { $this->rescheduleCount = $rescheduleCount; } /** * @return Collection */ public function getSubscribers(): Collection { return $this->subscribers; } /** * @param int $processed ScheduledTaskSubscriberEntity::PROCESSED_* constant * @return SubscriberEntity[] */ public function getSubscribersByProcessed(int $processed): array { $criteria = Criteria::create() ->where(Criteria::expr()->eq('processed', $processed)); $subscribers = $this->subscribers->matching($criteria)->map(function (ScheduledTaskSubscriberEntity $taskSubscriber): ?SubscriberEntity { return $taskSubscriber->getSubscriber(); }); return array_filter($subscribers->toArray()); } public function getSendingQueue(): ?SendingQueueEntity { $this->safelyLoadToOneAssociation('sendingQueue'); return $this->sendingQueue; } public function setSendingQueue(SendingQueueEntity $sendingQueue): void { $this->sendingQueue = $sendingQueue; } }