You are here

public function DispatchService::send in RNG - Events and Registrations 3.x

1 call to DispatchService::send()
DispatchService::sendRegistration in rng_easy_email/src/DispatchService.php

File

rng_easy_email/src/DispatchService.php, line 29

Class

DispatchService
Class DispatchService.

Namespace

Drupal\rng_easy_email

Code

public function send($template, RegistrantInterface $registrant) {
  $email = $this->easyEmailHandler
    ->createEmail([
    'type' => $template,
    'field_registrant' => $registrant
      ->id(),
    'field_registration' => $registrant
      ->getRegistration()
      ->id(),
    'field_event' => $registrant
      ->getEvent()
      ->id(),
  ]);
  if (!$this->easyEmailHandler
    ->duplicateExists($email)) {
    $this->easyEmailHandler
      ->sendEmail($email);
  }
}