123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350 |
- <?php
- namespace AppBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * Film
- *
- * @ORM\Table(name="film")
- * @ORM\Entity(repositoryClass="AppBundle\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=255)
- */
- 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;
- /**
- * @return \DateTime
- */
- public function getDateSubmited()
- {
- return $this->dateSubmited;
- }
- /**
- * @param \DateTime $dateSubmited
- */
- public function setDateSubmited(\DateTime $dateSubmited)
- {
- $this->dateSubmited = $dateSubmited;
- }
- /**
- * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Realisateur", inversedBy="films", cascade="persist")
- * @var \Doctrine\Common\Collections\Collection
- */
- private $realisateurs;
- /**
- * @ORM\ManyToOne(targetEntity="AppBundle\Entity\User")
- * @ORM\JoinColumn(nullable=true)
- */
- private $authered;
- /**
- * @ORM\ManyToMany(targetEntity="AppBundle\Entity\User", inversedBy="films")
- * @ORM\JoinTable(name="filmsavoir_users")
- * @var \Doctrine\Common\Collections\Collection
- */
- private $usersWantToView;
- /**
- * @ORM\ManyToMany(targetEntity="AppBundle\Entity\User", inversedBy="filmsVus")
- * @ORM\JoinTable(name="filmsvus_users")
- * @var \Doctrine\Common\Collections\Collection
- */
- private $usersWhoSeen;
- /**
- * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Genre", cascade={"persist"})
- * @var \Doctrine\Common\Collections\Collection
- */
- private $genres;
- /**
- * @return mixed
- */
- public function getAuthered()
- {
- return $this->authered;
- }
- /**
- * @param mixed $authered
- */
- public function setAuthered($authered)
- {
- $this->authered = $authered;
- $this->addUserWantToView($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;
- }
- /**
- * 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 \AppBundle\Entity\Realisateur $realisateur
- *
- * @return Film
- */
- public function addRealisateur(\AppBundle\Entity\Realisateur $realisateur)
- {
- $this->realisateurs[] = $realisateur;
- return $this;
- }
- /**
- * Remove realisateur
- *
- * @param \AppBundle\Entity\Realisateur $realisateur
- */
- public function removeRealisateur(\AppBundle\Entity\Realisateur $realisateur)
- {
- $this->realisateurs->removeElement($realisateur);
- }
- /**
- * Get realisateurs
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getRealisateurs()
- {
- return $this->realisateurs;
- }
- ///////////////////////////////////////////////////////
- /**
- * Add user
- *
- * @param \AppBundle\Entity\User $user
- *
- * @return film
- */
- public function addUserWantToView(\AppBundle\Entity\User $user)
- {
- $this->usersWantToView[] = $user;
- $user->addFilm($this);
- return $this;
- }
- /**
- * Remove user
- *
- * @param \AppBundle\Entity\User $user
- */
- public function removeUserWantToView(\AppBundle\Entity\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 \AppBundle\Entity\User $user
- */
- public function inverseUserWantToView(\AppBundle\Entity\User $user)
- {
- if ($this->usersWantToView->contains($user)) {
- $this->removeUserWantToView($user);
- } else {
- $this->addUserWantToView($user);
- }
- }
- /////////////////////////////////////////////////////////////////////
- /**
- * Add user
- *
- * @param \AppBundle\Entity\User $user
- *
- * @return film
- */
- public function addUserWhoSeen(\AppBundle\Entity\User $user)
- {
- $this->usersWhoSeen[] = $user;
- $user->addFilmVu($this);
- return $this;
- }
- /**
- * Remove user
- *
- * @param \AppBundle\Entity\User $user
- */
- public function removeUserWhoSeen(\AppBundle\Entity\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 \AppBundle\Entity\User $user
- */
- public function inverseUserWhoSeen(\AppBundle\Entity\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 \AppBundle\Entity\Genre $genre
- *
- * @return film
- */
- public function addGenre(\AppBundle\Entity\Genre $genre)
- {
- $this->genres[] = $genre;
- return $this;
- }
- /**
- * Remove genre
- *
- * @param \AppBundle\Entity\Genre $genre
- * @return Film
- */
- public function removeGenre(\AppBundle\Entity\Genre $genre)
- {
- $this->genres->removeElement($genre);
- return $this;
- }
- }
|