src/Entity/Session.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SessionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=SessionRepository::class)
  9.  */
  10. class Session
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="date")
  20.      */
  21.     private $date;
  22.     /**
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $numberD;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Movie::class, inversedBy="sessions")
  28.      * @ORM\JoinColumn(nullable=false)
  29.      */
  30.     private $idMovie;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=Reservation::class, mappedBy="idSession", orphanRemoval=true)
  33.      */
  34.     private $reservations;
  35.     /**
  36.      * @ORM\Column(type="time")
  37.      */
  38.     private $hours;
  39.     public function __construct()
  40.     {
  41.         $this->reservations = new ArrayCollection();
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getDate(): ?\DateTimeInterface
  48.     {
  49.         return $this->date;
  50.     }
  51.     public function setDate(\DateTimeInterface $date): self
  52.     {
  53.         $this->date $date;
  54.         return $this;
  55.     }
  56.     public function getNumberD(): ?int
  57.     {
  58.         return $this->numberD;
  59.     }
  60.     public function setNumberD(int $numberD): self
  61.     {
  62.         $this->numberD $numberD;
  63.         return $this;
  64.     }
  65.     public function getIdMovie(): ?Movie
  66.     {
  67.         return $this->idMovie;
  68.     }
  69.     public function setIdMovie(?Movie $idMovie): self
  70.     {
  71.         $this->idMovie $idMovie;
  72.         return $this;
  73.     }
  74.     /**
  75.      * @return Collection|Reservation[]
  76.      */
  77.     public function getReservations(): Collection
  78.     {
  79.         return $this->reservations;
  80.     }
  81.     public function addReservation(Reservation $reservation): self
  82.     {
  83.         if (!$this->reservations->contains($reservation)) {
  84.             $this->reservations[] = $reservation;
  85.             $reservation->setIdSession($this);
  86.         }
  87.         return $this;
  88.     }
  89.     public function removeReservation(Reservation $reservation): self
  90.     {
  91.         if ($this->reservations->removeElement($reservation)) {
  92.             // set the owning side to null (unless already changed)
  93.             if ($reservation->getIdSession() === $this) {
  94.                 $reservation->setIdSession(null);
  95.             }
  96.         }
  97.         return $this;
  98.     }
  99.     public function getHours(): ?\DateTimeInterface
  100.     {
  101.         return $this->hours;
  102.     }
  103.     public function setHours(\DateTimeInterface $hours): self
  104.     {
  105.         $this->hours $hours;
  106.         return $this;
  107.     }
  108. }