Example #1
0
 public function sendNotificationForNewMessage(Conversation $conversation, Message $message)
 {
     $send_to = $conversation->withUser($message->getFromUser());
     if (!$send_to->hasSendNotifications()) {
         // dont send if the user unchecked the "notify" setting on the profile form
         return;
     }
     $this->sendEmail($send_to, 'You received a new message', 'email/new-message.twig', ['message_from' => $message->getFromUser()->getName(), 'message_link' => $this->urlGenerator->generate('conversation.view', ['conversation_id' => $conversation->getId()], UrlGeneratorInterface::ABSOLUTE_URL)]);
 }