123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455 |
- <?php
- namespace App\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * Film
- *
- * @ORM\Table(name="film")
- * @ORM\Entity(repositoryClass="App\Repository\FilmRepository")
- */
- class Film
- {
- /**
- * @var int
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- *
- * @ORM\Column(name="titre", type="string", length=191)
- */
- private $titre;
- /**
- * @var \DateTime
- *
- * @ORM\Column(name="annee", type="date", nullable=true)
- */
- private $annee;
- /**
- * @var \DateTime
- *
- * @ORM\Column(name="date_submited", type="datetime", nullable=true)
- */
- private $dateSubmited;
- /**
- * @var string
- *
- * @ORM\Column(name="lien", type="string", length=191, nullable=true)
- * @Assert\Url()
- */
- private $lien;
- /**
- * @var float
- *
- * @ORM\Column(name="note", type="float", nullable=true)
- */
- private $note;
- /**
- * @var int
- *
- * @ORM\Column(name="nb_coms", type="integer", nullable=true)
- */
- private $nbComs;
- /**
- * @return \DateTime
- */
- public function getDateSubmited()
- {
- return $this->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;
- }
- }
|