/** * @param MailSystemResult $result * @param ProcessedOutboundMessage $processedMessage */ protected function handleMailSystemResult(MailSystemResult $result, ProcessedOutboundMessage $processedMessage) { $storableMessage = $processedMessage->getStorableMessage(); foreach ($result->getMailSystemMessagesStatus() as $mailSystemMessageStatus) { $messageStatus = new StorableOutboundMessageStatus($storableMessage, $mailSystemMessageStatus); $storableMessage->addMessageStatus($messageStatus); $this->entityManager->persist($messageStatus); } $this->entityManager->flush(); }
/** * @param ProcessedOutboundMessage $processedMessage * @throws MailSystemException */ protected function scheduleProcessedMessage(ProcessedOutboundMessage $processedMessage) { $sendAt = $processedMessage->getStorableMessage()->getScheduledSendTime(); $result = $this->mailSystem->scheduleMessage($processedMessage->getUniqueOutboundMessage(), $sendAt); $this->handleMailSystemResult($result, $processedMessage); }