You are here

public function MailEntity::__construct in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 src/Mail/MailEntity.php \Drupal\simplenews\Mail\MailEntity::__construct()
  2. 8 src/Mail/MailEntity.php \Drupal\simplenews\Mail\MailEntity::__construct()

Constructs a MailEntity object.

File

src/Mail/MailEntity.php, line 64

Class

MailEntity
Default mail class for entities.

Namespace

Drupal\simplenews\Mail

Code

public function __construct(ContentEntityInterface $issue, SubscriberInterface $subscriber, MailCacheInterface $mail_cache) {
  $this->subscriber = $subscriber;
  $this->issue = $issue;
  if ($this->issue
    ->hasTranslation($this
    ->getLanguage())) {
    $this->issue = $this->issue
      ->getTranslation($this
      ->getLanguage());
  }
  $this->cache = $mail_cache;
  $this->newsletter = $issue->simplenews_issue->entity;
}