Refactor sendingQueue to distinguish bulk/individual sending method

[MAILPOET-1154]
This commit is contained in:
Rostislav Wolny
2018-09-11 16:56:26 +02:00
parent 3ae8763837
commit ea4c5f46fb
4 changed files with 53 additions and 15 deletions

View File

@ -54,11 +54,25 @@ class Mailer {
return $this->mailer->formatSubscriberNameAndEmailAddress($subscriber);
}
function send($prepared_newsletters, $prepared_subscribers, $extra_params = array()) {
function sendBulk($prepared_newsletters, $prepared_subscribers, $extra_params = array()) {
if($this->getProcessingMethod() === 'individual') {
throw new \LogicException('Trying to send a batch with individual processing method');
}
return $this->mailer->mailer_instance->send(
$prepared_newsletters,
$prepared_subscribers,
$extra_params
);
}
function send($prepared_newsletter, $prepared_subscriber, $extra_params = array()) {
if($this->getProcessingMethod() === 'bulk') {
throw new \LogicException('Trying to send an individual email with a bulk processing method');
}
return $this->mailer->mailer_instance->send(
$prepared_newsletter,
$prepared_subscriber,
$extra_params
);
}
}