예제 #1
0
 public function findNewerEpisodes(Episode $episode, $numberEpisodes = 3)
 {
     return $this->getEntityManager()->createQuery('SELECT e FROM AppBundle:Episode e
             WHERE e.series = :series_id
             AND e.onlineStart > :episode_date
             AND e.isActive = 1
             ORDER BY e.onlineStart ASC')->setParameter('series_id', $episode->getSeries()->getId())->setParameter('episode_date', $episode->getOnlineStart())->setMaxResults($numberEpisodes)->getResult();
 }
예제 #2
0
 public function createNewEpisodeNotifications(Episode $episode)
 {
     $notifications = [];
     $mails = [];
     foreach ($episode->getSeries()->getAbonnements() as $abonnement) {
         if ($abonnement->getNewEpisode()) {
             $notification = new Notification();
             $notification->setEpisode($episode);
             $notification->setType(Notification::NEW_EPISODE);
             $abonnement->getUser()->addNotification($notification);
             $notifications[] = $notification;
             if ($abonnement->getSendMails()) {
                 $mails[] = $notification;
             }
         }
     }
     $this->sendMails(Notification::NEW_EPISODE, $mails);
     $this->saveNotifications($notifications);
 }
예제 #3
0
 /**
  * @Route("/channel/episode/{uniqID}", name="oktothek_channel_episode")
  * @Method({"GET"})
  * @Template()
  */
 public function episodeAction(Episode $episode)
 {
     $this->denyAccessUnlessGranted('view_channel', $episode->getSeries());
     $analytics = $this->get('oktothek_producer_analytics');
     $clicks2weeks = $analytics->getAnalyticsForEpisode($episode);
     $clicks48 = $analytics->getAnalyticsForEpisode($episode, '+1 hour', '-2 days');
     return ['episode' => $episode, 'clicks2weeks' => $clicks2weeks, 'clicks48' => $clicks48];
 }