public function EmailHandler::duplicateExists in Easy Email 2.0.x
Same name and namespace in other branches
- 8 src/Service/EmailHandler.php \Drupal\easy_email\Service\EmailHandler::duplicateExists()
@inheritDoc
Overrides EmailHandlerInterface::duplicateExists
1 call to EmailHandler::duplicateExists()
- EmailHandler::sendEmail in src/
Service/ EmailHandler.php - @inheritDoc
File
- src/
Service/ EmailHandler.php, line 132
Class
Namespace
Drupal\easy_email\ServiceCode
public function duplicateExists(EasyEmailInterface $email) {
if ($email
->hasField('key') && ($key = $email
->getKey())) {
$email = $email
->createDuplicate();
$this->userEvaluator
->evaluateUsers($email);
$key = $this->tokenEvaluator
->replaceTokens($email, $key);
$result = $this->emailStorage
->getQuery()
->condition('key', $key)
->exists('sent')
->range(0, 1)
->execute();
if (!empty($result)) {
return TRUE;
}
}
return FALSE;
}