Replace NewsletterLink with NewsletterLinkEntity in the class Links

It was also necessary to update two NewsletterTest tests, as after the
change to Links::save(), having a queue ID set became mandatory (before
it was not and one was not set properly in the mock SendingQueue object).

[MAILPOET-3816]
This commit is contained in:
Rodrigo Primo
2021-10-14 15:20:54 -03:00
committed by Veljko V
parent c870c416ad
commit d9296d86fd
3 changed files with 74 additions and 25 deletions

View File

@@ -99,4 +99,16 @@ class NewsletterLinkEntity {
public function getTotalClicksCount() {
return $this->clicks->count();
}
public function toArray(): array {
return [
'id' => $this->getId(),
'newsletter_id' => ($this->getNewsletter() instanceof NewsletterEntity) ? $this->getNewsletter()->getId() : null,
'queue_id' => ($this->getQueue() instanceof SendingQueueEntity) ? $this->getQueue()->getId() : null,
'url' => $this->getUrl(),
'hash' => $this->getHash(),
'created_at' => $this->getCreatedAt(),
'updated_at' => $this->getUpdatedAt(),
];
}
}