コード例 #1
0
ファイル: AbstractNotifier.php プロジェクト: opexsw/magento2
 /**
  * Notify user
  *
  * @param AbstractModel $model
  * @return bool
  * @throws \Magento\Framework\Exception\MailException
  */
 public function notify(\Magento\Sales\Model\AbstractModel $model)
 {
     try {
         $this->sender->send($model);
         if (!$model->getEmailSent()) {
             return false;
         }
         $historyItem = $this->historyCollectionFactory->create()->getUnnotifiedForInstance($model);
         if ($historyItem) {
             $historyItem->setIsCustomerNotified(1);
             $historyItem->save();
         }
     } catch (\Magento\Framework\Exception\MailException $e) {
         $this->logger->critical($e);
         return false;
     }
     return true;
 }