src/Entity/Promo.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PromoRepository;
  4. use App\Trait\OperationValue;
  5. use DateTimeInterface;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. #[ORM\Entity(repositoryClassPromoRepository::class)]
  12. class Promo
  13. {
  14.     use OperationValue;
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column(type'integer')]
  18.     private $id;
  19.     #[ORM\Column(length255)]
  20.     #[Assert\NotBlank]
  21.     private ?string $title null;
  22.     // for EB-Period this corresponds to start-date of the Promo Period
  23.     // for SPO this corresponds to start-date of the Promo Arrival Period
  24.     #[ORM\Column(type'datetime'nullabletrue)]
  25.     private ?DateTimeInterface $checkinStartDate;
  26.     // for EB-Period this corresponds to end-date of the Promo Period
  27.     // for SPO this corresponds to end-date of the Promo Arrival Period
  28.     #[ORM\Column(type'datetime')]
  29.     private ?DateTimeInterface $checkInEndDate;
  30.     // Mandatory for EB-Period (promoType = 1)
  31.     #[ORM\Column(type'datetime'nullabletrue)]
  32.     private ?DateTimeInterface $ebStartDate;
  33.     // Mandatory for EB-Period (promoType = 1)
  34.     #[ORM\Column(type'datetime'nullabletrue)]
  35.     private ?DateTimeInterface $ebEndDate;
  36.     // Mandatory for EB-J- (promoType = 2)
  37.     #[Assert\Positive]
  38.     #[ORM\Column(type'smallint'nullabletrue)]
  39.     private ?int $ebDaysBefore;
  40.     #[ORM\Column(typeTypes::SMALLINT)]
  41.     private ?int $promoType null;
  42.     #[Assert\Positive]
  43.     #[ORM\Column(typeTypes::SMALLINTnullabletrue)]
  44.     private ?int $minStay null;
  45.     #[Assert\Positive]
  46.     #[ORM\Column(typeTypes::SMALLINTnullabletrue)]
  47.     private ?int $maxStay null;
  48.     #[ORM\ManyToOne(inversedBy'promos')]
  49.     #[ORM\JoinColumn(nullablefalse)]
  50.     private ?HotelContract $hotelContract null;
  51.     #[ORM\ManyToMany(targetEntityHotelRoomTypeArrangement::class)]
  52.     private Collection $hrtaCombinations;
  53.     public function __construct()
  54.     {
  55.         $this->hrtaCombinations = new ArrayCollection();
  56.     }
  57.     public function getId(): ?int
  58.     {
  59.         return $this->id;
  60.     }
  61.     public function getCheckinStartDate(): ?DateTimeInterface
  62.     {
  63.         return $this->checkinStartDate;
  64.     }
  65.     public function setCheckinStartDate(?DateTimeInterface $checkinStartDate): self
  66.     {
  67.         $this->checkinStartDate $checkinStartDate;
  68.         return $this;
  69.     }
  70.     public function getCheckInEndDate(): ?DateTimeInterface
  71.     {
  72.         return $this->checkInEndDate;
  73.     }
  74.     public function setCheckInEndDate(?DateTimeInterface $checkInEndDate): self
  75.     {
  76.         $this->checkInEndDate $checkInEndDate;
  77.         return $this;
  78.     }
  79.     public function getEbStartDate(): ?DateTimeInterface
  80.     {
  81.         return $this->ebStartDate;
  82.     }
  83.     public function setEbStartDate(?DateTimeInterface $ebStartDate): self
  84.     {
  85.         $this->ebStartDate $ebStartDate;
  86.         return $this;
  87.     }
  88.     public function getEbEndDate(): ?DateTimeInterface
  89.     {
  90.         return $this->ebEndDate;
  91.     }
  92.     public function setEbEndDate(?DateTimeInterface $ebEndDate): self
  93.     {
  94.         $this->ebEndDate $ebEndDate;
  95.         return $this;
  96.     }
  97.     public function getEbDaysBefore(): ?int
  98.     {
  99.         return $this->ebDaysBefore;
  100.     }
  101.     public function setEbDaysBefore(?int $ebDaysBefore): self
  102.     {
  103.         $this->ebDaysBefore $ebDaysBefore;
  104.         return $this;
  105.     }
  106.     public function getPromoType(): ?int
  107.     {
  108.         return $this->promoType;
  109.     }
  110.     public function getPromoTypeFlag(): ?string
  111.     {
  112.         if($this->promoType == or $this->promoType == 2){
  113.             return "Entities.Promo.FieldsValues.PromoTypeFlagEarlyBooking";
  114.         }elseif ($this->promoType==3){
  115.             return "Entities.Promo.FieldsValues.PromoTypeFlagSPO"// special offer
  116.         }
  117.         return "Entities.Promo.FieldsValues.PromoTypeFlagPromo";
  118.     }
  119.     public function setPromoType(int $promoType): self
  120.     {
  121.         $this->promoType $promoType;
  122.         return $this;
  123.     }
  124.     public function getMinStay(): ?int
  125.     {
  126.         return $this->minStay;
  127.     }
  128.     public function setMinStay(?int $minStay): self
  129.     {
  130.         $this->minStay $minStay;
  131.         return $this;
  132.     }
  133.     public function getMaxStay(): ?int
  134.     {
  135.         return $this->maxStay;
  136.     }
  137.     public function setMaxStay(?int $maxStay): self
  138.     {
  139.         $this->maxStay $maxStay;
  140.         return $this;
  141.     }
  142.     public function getHotelContract(): ?HotelContract
  143.     {
  144.         return $this->hotelContract;
  145.     }
  146.     public function setHotelContract(?HotelContract $hotelContract): self
  147.     {
  148.         $this->hotelContract $hotelContract;
  149.         return $this;
  150.     }
  151.     /**
  152.      * @return Collection<int, HotelRoomTypeArrangement>
  153.      */
  154.     public function getHrtaCombinations(): Collection
  155.     {
  156.         return $this->hrtaCombinations;
  157.     }
  158.     public function addHrtaCombination(HotelRoomTypeArrangement $hrtaCombination): self
  159.     {
  160.         if (!$this->hrtaCombinations->contains($hrtaCombination)) {
  161.             $this->hrtaCombinations->add($hrtaCombination);
  162.         }
  163.         return $this;
  164.     }
  165.     public function removeHrtaCombination(HotelRoomTypeArrangement $hrtaCombination): self
  166.     {
  167.         $this->hrtaCombinations->removeElement($hrtaCombination);
  168.         return $this;
  169.     }
  170.     public function __toString(): string
  171.     {
  172.         return $this->title;
  173.     }
  174.     public function getTitle(): ?string
  175.     {
  176.         return $this->title;
  177.     }
  178.     public function setTitle(string $title): self
  179.     {
  180.         $this->title $title;
  181.         return $this;
  182.     }
  183. }