示例#1
0
 public function createLivestreamNotifications(Series $series)
 {
     $notifications = [];
     $mails = [];
     foreach ($series->getAbonnements() as $abonnement) {
         if ($abonnement->getLivestream()) {
             $notification = new Notification();
             $notification->setUser($abonnement->getUser());
             $notification->setSeries($series);
             $notification->setType(Notification::LIVESTREAM);
             $notifications[] = $notification;
             if ($abonnement->getSendMails()) {
                 $mails[] = $notification;
             }
         }
     }
     $this->sendMails(Notification::LIVESTREAM, $mails);
     $this->saveNotifications($notifications);
 }