dateSubmited; } /** * @param \DateTime $dateSubmited */ public function setDateSubmited(\DateTime $dateSubmited) { $this->dateSubmited = $dateSubmited; } /** * @return boolean */ public function isNew() { $finNew = $this->getDateSubmited()->modify('+1 day'); return (new \DateTime('now') < $finNew); } /** * @Assert\Valid() * @ORM\OneToOne(targetEntity="App\Entity\MediaVideo", cascade={"persist","remove"}) * @ORM\JoinColumn(nullable=true) */ private $mediaVideo; /** * @ORM\ManyToMany(targetEntity="App\Entity\Realisateur", inversedBy="films", cascade="persist") * @var \Doctrine\Common\Collections\Collection */ private $realisateurs; /** * @ORM\ManyToOne(targetEntity="App\Entity\User") * @ORM\JoinColumn(nullable=true) */ private $authered; /** * @ORM\ManyToMany(targetEntity="App\Entity\User", inversedBy="films") * @ORM\JoinTable(name="filmsavoir_users") * @var \Doctrine\Common\Collections\Collection */ private $usersWantToView; /** * @ORM\ManyToMany(targetEntity="App\Entity\User", inversedBy="filmsVus") * @ORM\JoinTable(name="filmsvus_users") * @var \Doctrine\Common\Collections\Collection */ private $usersWhoSeen; /** * @return \App\Entity\MediaVideo $mediaVideo */ public function getMediaVideo() { return $this->mediaVideo; } /** * @param \App\Entity\MediaVideo $mediaVideo */ public function setMediaVideo(MediaVideo $mediaVideo = null) { $this->mediaVideo = $mediaVideo; } /** * @ORM\ManyToMany(targetEntity="App\Entity\Genre", cascade={"persist"}) * @var \Doctrine\Common\Collections\Collection */ private $genres; /** * @return \App\Entity\User $authered */ public function getAuthered() { return $this->authered; } /** * @param \App\Entity\User $authered */ public function setAuthered(User $authered) { $this->authered = $authered; } /** * Get id * * @return int */ public function getId() { return $this->id; } /** * Set titre * * @param string $titre * * @return Film */ public function setTitre($titre) { $this->titre = $titre; return $this; } /** * Get titre * * @return string */ public function getTitre() { return $this->titre; } /** * Set annee * * @param \DateTime $annee * * @return Film */ public function setAnnee($annee) { $this->annee = $annee; return $this; } /** * Get annee * * @return \DateTime */ public function getAnnee() { return $this->annee; } /** * @return string */ public function getLien() { return $this->lien; } /** * @param string $lien */ public function setLien($lien = null) { $this->lien = $lien; } /** * Constructor */ public function __construct() { $this->realisateurs = new \Doctrine\Common\Collections\ArrayCollection(); $this->usersWantToView = new \Doctrine\Common\Collections\ArrayCollection(); $this->usersWhoSeen = new \Doctrine\Common\Collections\ArrayCollection(); $this->genres = new \Doctrine\Common\Collections\ArrayCollection(); $this->setDateSubmited(new \DateTime()); } /** * Add realisateur * * @param \App\Entity\Realisateur $realisateur * * @return Film */ public function addRealisateur(Realisateur $realisateur) { $this->realisateurs[] = $realisateur; return $this; } /** * Remove realisateur * * @param \App\Entity\Realisateur $realisateur */ public function removeRealisateur(Realisateur $realisateur) { $this->realisateurs->removeElement($realisateur); } /** * Get realisateurs * * @return \Doctrine\Common\Collections\Collection */ public function getRealisateurs() { return $this->realisateurs; } /////////////////////////////////////////////////////// /** * Add user * * @param \App\Entity\User $user * * @return film */ public function addUserWantToView(User $user) { $this->usersWantToView[] = $user; $user->addFilm($this); return $this; } /** * Remove user * * @param \App\Entity\User $user */ public function removeUserWantToView(User $user) { $this->usersWantToView->removeElement($user); $user->removeFilm($this); } /** * Get usersWantToView * * @return \Doctrine\Common\Collections\Collection */ public function getUsersWantToView() { return $this->usersWantToView; } /** * Inverse ToSee * @param \App\Entity\User $user */ public function inverseUserWantToView(User $user) { if ($this->usersWantToView->contains($user)) { $this->removeUserWantToView($user); } else { $this->addUserWantToView($user); } } ///////////////////////////////////////////////////////////////////// /** * Add user * * @param \App\Entity\User $user * * @return film */ public function addUserWhoSeen(User $user) { $this->usersWhoSeen[] = $user; $user->addFilmVu($this); return $this; } /** * Remove user * * @param \App\Entity\User $user */ public function removeUserWhoSeen(User $user) { $this->usersWhoSeen->removeElement($user); $user->removeFilmVu($this); } /** * Get usersWantToView * * @return \Doctrine\Common\Collections\Collection */ public function getUsersWhoSeen() { return $this->usersWhoSeen; } /** * Inverse ToSee * @param \App\Entity\User $user */ public function inverseUserWhoSeen(User $user) { if ($this->usersWhoSeen->contains($user)) { $this->removeUserWhoSeen($user); } else { $this->addUserWhoSeen($user); } } /** * Get genre * * @return \Doctrine\Common\Collections\Collection */ public function getGenres() { return $this->genres; } /** * Add genre * * @param \App\Entity\Genre $genre * * @return film */ public function addGenre(Genre $genre) { $this->genres[] = $genre; return $this; } /** * Remove genre * * @param \App\Entity\Genre $genre * @return Film */ public function removeGenre(Genre $genre) { $this->genres->removeElement($genre); return $this; } /** * @return float */ public function getNote() { return $this->note; } /** * @param float $note */ public function setNote($note) { $this->note = $note; } /** * @return int */ public function getNbComs() { return $this->nbComs; } /** * @param int $nbComs */ public function setNbComs($nbComs) { $this->nbComs = $nbComs; } }