Add isTransactional method to NewsletterEntity

[MAILPOET-6115]
This commit is contained in:
David Remer
2024-06-21 08:26:10 +03:00
committed by Veljko V
parent 2cba628c29
commit fd0d1036e6
3 changed files with 19 additions and 7 deletions

View File

@@ -187,11 +187,6 @@ class SendingQueue {
return;
}
$isTransactional = in_array($newsletter->getType(), [
NewsletterEntity::TYPE_AUTOMATION_TRANSACTIONAL,
NewsletterEntity::TYPE_WC_TRANSACTIONAL_EMAIL,
]);
// configure mailer
$this->mailerTask->configureMailer($newsletter);
// get newsletter segments
@@ -272,7 +267,7 @@ class SendingQueue {
->setParameter('subscriberIds', $subscribersToProcessIds)
->andWhere('s.deletedAt IS NULL');
if ($newsletter->getType() === NewsletterEntity::TYPE_AUTOMATION_TRANSACTIONAL) {
if ($newsletter->isTransactional()) {
$queryBuilder->andWhere('s.status != :bouncedStatus')
->setParameter('bouncedStatus', SubscriberEntity::STATUS_BOUNCED);
} else {
@@ -323,7 +318,7 @@ class SendingQueue {
$foundSubscribers,
$timer
);
if (!$isTransactional) {
if (!$newsletter->isTransactional()) {
$this->entityManager->wrapInTransaction(function() use ($foundSubscribersIds) {
$now = Carbon::createFromTimestamp((int)current_time('timestamp'));
$this->subscribersRepository->bulkUpdateLastSendingAt($foundSubscribersIds, $now);