public function findActiveEpisodes(Series $series, $query_only = false) { $query = $this->getEntityManager()->createQuery("SELECT e FROM AppBundle:Episode e\n WHERE e.series = :series_id\n AND (e.onlineStart < :online_start OR e.onlineStart IS NULL)\n AND e.isActive = 1")->setParameter('series_id', $series->getId())->setParameter('online_start', new \DateTime()); if ($query_only) { return $query; } return $query->getResult(); }
/** * Edits an existing Series entity. * * @Route("/{id}/edit", name="series_edit") * @Method("PUT|GET") */ public function updateAction(Request $request, Series $series) { $em = $this->getDoctrine()->getManager(); $deleteForm = $this->createDeleteForm($series->getId()); $editForm = $this->createForm(new SeriesType(), $series, array('action' => $this->generateUrl('series_edit', array('id' => $series->getId())), 'method' => 'PUT')); $editForm->add('submit', 'submit', array('label' => 'Update')); $editForm->handleRequest($request); if ($editForm->isValid()) { $em->flush(); return $this->redirect($this->generateUrl('series')); } return $this->render('AppBundle:Series:edit.html.twig', ['serie' => $series, 'edit_form' => $editForm->createView(), 'delete_form' => $deleteForm->createView()]); }
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); }
private function canEdit(Series $series, User $user) { $users = $series->getUsers()->toArray(); return in_array($user, $users); }
public function buildForm(FormBuilderInterface $builder, array $options) { $series = new Series(); $builder->add('title', 'text', ['attr' => ['data-login-type' => $series->getTitle()]])->add('description', null, ['required' => false])->add('duration')->add('seriesReleased', 'date', ['widget' => 'single_text', 'format' => 'dd-MM-yyyy', 'attr' => ['class' => 'form-control input-inline datepicker', 'data-provide' => 'datepicker', 'data-date-format' => 'dd-mm-yyyy']]); }
/** * @param Series $series * @return Season */ public function addSery(Series $series) { $this->series[] = $series; $series->setSeason($this); return $this; }