src/Entity/StopsaleHotel.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\StopsaleHotelRepository;
  4. use DateTimeInterface;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. #[ORM\Entity(repositoryClassStopsaleHotelRepository::class)]
  11. class StopsaleHotel
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\ManyToOne]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private ?Market $market null;
  20.     #[ORM\ManyToOne(inversedBy'stopsales')]
  21.     #[ORM\JoinColumn(nullablefalse)]
  22.     private ?HotelContract $hotelContract null;
  23.     #[Assert\NotNull]
  24.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullablefalse)]
  25.     private ?DateTimeInterface $startDate null;
  26.     #[Assert\NotNull]
  27.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullablefalse)]
  28.     private ?DateTimeInterface $endDate null;
  29.     #[ORM\ManyToMany(targetEntityHotelRoomTypeArrangement::class)]
  30.     private Collection $combinations;
  31.     public function __construct()
  32.     {
  33.         $this->combinations = new ArrayCollection();
  34.     }
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getHotelContract(): ?HotelContract
  40.     {
  41.         return $this->hotelContract;
  42.     }
  43.     public function setHotelContract(?HotelContract $hotelContract): self
  44.     {
  45.         $this->hotelContract $hotelContract;
  46.         return $this;
  47.     }
  48.     public function getMarket(): ?Market
  49.     {
  50.         return $this->market;
  51.     }
  52.     public function setMarket(?Market $market): self
  53.     {
  54.         $this->market $market;
  55.         return $this;
  56.     }
  57.     public function getStartDate(): ?DateTimeInterface
  58.     {
  59.         return $this->startDate;
  60.     }
  61.     public function setStartDate(?DateTimeInterface $startDate): self
  62.     {
  63.         $this->startDate $startDate;
  64.         return $this;
  65.     }
  66.     public function getEndDate(): ?DateTimeInterface
  67.     {
  68.         return $this->endDate;
  69.     }
  70.     public function setEndDate(?DateTimeInterface $endDate): self
  71.     {
  72.         $this->endDate $endDate;
  73.         return $this;
  74.     }
  75.     /**
  76.      * @return Collection<int, HotelRoomTypeArrangement>
  77.      */
  78.     public function getCombinations(): Collection
  79.     {
  80.         return $this->combinations;
  81.     }
  82.     public function addCombination(HotelRoomTypeArrangement $combination): self
  83.     {
  84.         if (!$this->combinations->contains($combination)) {
  85.             $this->combinations->add($combination);
  86.         }
  87.         return $this;
  88.     }
  89.     public function removeCombination(HotelRoomTypeArrangement $combination): self
  90.     {
  91.         $this->combinations->removeElement($combination);
  92.         return $this;
  93.     }
  94.     public function __toString(): string
  95.     {
  96.         return 'StopSale '.$this->startDate->format('d/m/y').' TO '.$this->endDate->format('d/m/y');
  97.     }
  98. }