コード例 #1
0
ファイル: CommentAction.php プロジェクト: blump/Comment
 /**
  * Notify shop managers of a new comment.
  * @param CommentCreateEvent $event
  */
 public function notifyAdminOfNewComment(CommentCreateEvent $event)
 {
     $config = \Comment\Comment::getConfig();
     if (!$config["notify_admin_new_comment"]) {
         return;
     }
     $comment = $event->getComment();
     if ($comment === null) {
         return;
     }
     // get the default shop locale
     $shopLang = LangQuery::create()->findOneByByDefault(true);
     if ($shopLang !== null) {
         $shopLocale = $shopLang->getLocale();
     } else {
         $shopLocale = null;
     }
     $getCommentRefEvent = new CommentReferenceGetterEvent($comment->getRef(), $comment->getRefId(), $shopLocale);
     $event->getDispatcher()->dispatch(CommentEvents::COMMENT_REFERENCE_GETTER, $getCommentRefEvent);
     $this->mailer->sendEmailToShopManagers('new_comment_notification_admin', ['comment_id' => $comment->getId(), 'ref_title' => $getCommentRefEvent->getTitle(), 'ref_type_title' => $getCommentRefEvent->getTypeTitle()]);
 }
コード例 #2
0
ファイル: Order.php プロジェクト: badelas/thelia
 /**
  * @param OrderEvent $event
  *
  * @throws \Exception if the message cannot be loaded.
  */
 public function sendNotificationEmail(OrderEvent $event)
 {
     $this->mailer->sendEmailToShopManagers('order_notification', ['order_id' => $event->getOrder()->getId(), 'order_ref' => $event->getOrder()->getRef()]);
 }