src/Entity/Reservation.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ReservationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. #[ORM\Entity(repositoryClassReservationRepository::class)]
  10. class Reservation
  11. {
  12.     const ONE_WEEK 1;
  13.     const TWO_WEEKS 2;
  14.     const FOUR_WEEKS 4;
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     #[Groups(["getReservation"])]
  19.     private ?int $id null;
  20.     #[ORM\ManyToOne]
  21.     #[ORM\JoinColumn(nullablefalse)]
  22.     #[Groups(["getReservation"])]
  23.     private ?Project $project null;
  24.     #[ORM\ManyToOne(inversedBy'reservation')]
  25.     #[ORM\JoinColumn(nullablefalse)]
  26.     #[Groups(["getReservation"])]
  27.     private ?User $employee null;
  28.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  29.     #[Groups(["getReservation"])]
  30.     private ?\DateTimeInterface $startDate null;
  31.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  32.     #[Groups(["getReservation"])]
  33.     private ?\DateTimeInterface $endDate null;
  34.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  35.     #[Groups(["getReservation"])]
  36.     private ?\DateTimeInterface $startTime null;
  37.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  38.     #[Groups(["getReservation"])]
  39.     private ?\DateTimeInterface $endTime null;
  40.     #[ORM\Column]
  41.     #[Groups(["getReservation"])]
  42.     private ?int $occurrence null;
  43.     #[ORM\OneToMany(mappedBy'reservation'targetEntitySchedules::class)]
  44.     #[Groups(["getReservation"])]
  45.     private Collection $schedules;
  46.     #[ORM\Column(nullabletrue)]
  47.     #[Groups(["getReservation"])]
  48.     private ?int $day null;
  49.     public function __construct()
  50.     {
  51.         $this->schedules = new ArrayCollection();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getProject(): ?Project
  58.     {
  59.         return $this->project;
  60.     }
  61.     public function setProject(?Project $project): self
  62.     {
  63.         $this->project $project;
  64.         return $this;
  65.     }
  66.     public function getEmployee(): ?User
  67.     {
  68.         return $this->employee;
  69.     }
  70.     public function setEmployee(?User $employee): self
  71.     {
  72.         $this->employee $employee;
  73.         return $this;
  74.     }
  75.     public function getStartDate(): ?\DateTimeInterface
  76.     {
  77.         return $this->startDate;
  78.     }
  79.     public function setStartDate(\DateTimeInterface $startDate): self
  80.     {
  81.         $this->startDate $startDate;
  82.         return $this;
  83.     }
  84.     public function getEndDate(): ?\DateTimeInterface
  85.     {
  86.         return $this->endDate;
  87.     }
  88.     public function setEndDate(\DateTimeInterface $endDate): self
  89.     {
  90.         $this->endDate $endDate;
  91.         return $this;
  92.     }
  93.     public function getStartTime(): ?\DateTimeInterface
  94.     {
  95.         return $this->startTime;
  96.     }
  97.     public function setStartTime(\DateTimeInterface $startTime): self
  98.     {
  99.         $this->startTime $startTime;
  100.         return $this;
  101.     }
  102.     public function getEndTime(): ?\DateTimeInterface
  103.     {
  104.         return $this->endTime;
  105.     }
  106.     public function setEndTime(\DateTimeInterface $endTime): self
  107.     {
  108.         $this->endTime $endTime;
  109.         return $this;
  110.     }
  111.     public function getOccurrence(): ?int
  112.     {
  113.         return $this->occurrence;
  114.     }
  115.     public function setOccurrence(int $occurrence): self
  116.     {
  117.         $this->occurrence $occurrence;
  118.         return $this;
  119.     }
  120.     /**
  121.      * @return Collection<int, Schedules>
  122.      */
  123.     public function getSchedules(): Collection
  124.     {
  125.         return $this->schedules;
  126.     }
  127.     public function addSchedule(Schedules $schedule): self
  128.     {
  129.         if (!$this->schedules->contains($schedule)) {
  130.             $this->schedules->add($schedule);
  131.             $schedule->setReservation($this);
  132.         }
  133.         return $this;
  134.     }
  135.     public function removeSchedule(Schedules $schedule): self
  136.     {
  137.         if ($this->schedules->removeElement($schedule)) {
  138.             // set the owning side to null (unless already changed)
  139.             if ($schedule->getReservation() === $this) {
  140.                 $schedule->setReservation(null);
  141.             }
  142.         }
  143.         return $this;
  144.     }
  145.     public function getDay(): ?int
  146.     {
  147.         return $this->day;
  148.     }
  149.     public function setDay(?int $day): self
  150.     {
  151.         $this->day $day;
  152.         return $this;
  153.     }
  154. }