class DispatchService in RNG - Events and Registrations 3.x
Class DispatchService.
Hierarchy
- class \Drupal\rng_easy_email\DispatchService
Expanded class hierarchy of DispatchService
1 file declares its use of DispatchService
- RegistrationSubscriber.php in rng_easy_email/
src/ EventSubscriber/ RegistrationSubscriber.php
1 string reference to 'DispatchService'
- rng_easy_email.services.yml in rng_easy_email/
rng_easy_email.services.yml - rng_easy_email/rng_easy_email.services.yml
1 service uses DispatchService
File
- rng_easy_email/
src/ DispatchService.php, line 13
Namespace
Drupal\rng_easy_emailView source
class DispatchService {
/**
* Drupal\easy_email\Service\EmailHandlerInterface definition.
*
* @var \Drupal\easy_email\Service\EmailHandlerInterface
*/
protected $easyEmailHandler;
/**
* Constructs a new DispatchService object.
*/
public function __construct(EmailHandlerInterface $easy_email_handler) {
$this->easyEmailHandler = $easy_email_handler;
}
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);
}
}
public function sendRegistration($template, RegistrationInterface $registration) {
// Don't send for events in the past, to allow import of old registrants.
$event = $registration
->getEventMeta();
if ($event
->isPastEvent()) {
return;
}
foreach ($registration
->getRegistrants() as $registrant) {
$this
->send($template, $registrant);
}
}
public function sendEvent($template, ContentEntityInterface $contentEntity) {
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DispatchService:: |
protected | property | Drupal\easy_email\Service\EmailHandlerInterface definition. | |
DispatchService:: |
public | function | ||
DispatchService:: |
public | function | ||
DispatchService:: |
public | function | ||
DispatchService:: |
public | function | Constructs a new DispatchService object. |