<?phpnamespace App\Entity;use App\Repository\PromoRepository;use App\Trait\OperationValue;use DateTimeInterface;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: PromoRepository::class)]class Promo{ use OperationValue; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\Column(length: 255)] #[Assert\NotBlank] private ?string $title = null; // for EB-Period this corresponds to start-date of the Promo Period // for SPO this corresponds to start-date of the Promo Arrival Period #[ORM\Column(type: 'datetime', nullable: true)] private ?DateTimeInterface $checkinStartDate; // for EB-Period this corresponds to end-date of the Promo Period // for SPO this corresponds to end-date of the Promo Arrival Period #[ORM\Column(type: 'datetime')] private ?DateTimeInterface $checkInEndDate; // Mandatory for EB-Period (promoType = 1) #[ORM\Column(type: 'datetime', nullable: true)] private ?DateTimeInterface $ebStartDate; // Mandatory for EB-Period (promoType = 1) #[ORM\Column(type: 'datetime', nullable: true)] private ?DateTimeInterface $ebEndDate; // Mandatory for EB-J- (promoType = 2) #[Assert\Positive] #[ORM\Column(type: 'smallint', nullable: true)] private ?int $ebDaysBefore; #[ORM\Column(type: Types::SMALLINT)] private ?int $promoType = null; #[Assert\Positive] #[ORM\Column(type: Types::SMALLINT, nullable: true)] private ?int $minStay = null; #[Assert\Positive] #[ORM\Column(type: Types::SMALLINT, nullable: true)] private ?int $maxStay = null; #[ORM\ManyToOne(inversedBy: 'promos')] #[ORM\JoinColumn(nullable: false)] private ?HotelContract $hotelContract = null; #[ORM\ManyToMany(targetEntity: HotelRoomTypeArrangement::class)] private Collection $hrtaCombinations; public function __construct() { $this->hrtaCombinations = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getCheckinStartDate(): ?DateTimeInterface { return $this->checkinStartDate; } public function setCheckinStartDate(?DateTimeInterface $checkinStartDate): self { $this->checkinStartDate = $checkinStartDate; return $this; } public function getCheckInEndDate(): ?DateTimeInterface { return $this->checkInEndDate; } public function setCheckInEndDate(?DateTimeInterface $checkInEndDate): self { $this->checkInEndDate = $checkInEndDate; return $this; } public function getEbStartDate(): ?DateTimeInterface { return $this->ebStartDate; } public function setEbStartDate(?DateTimeInterface $ebStartDate): self { $this->ebStartDate = $ebStartDate; return $this; } public function getEbEndDate(): ?DateTimeInterface { return $this->ebEndDate; } public function setEbEndDate(?DateTimeInterface $ebEndDate): self { $this->ebEndDate = $ebEndDate; return $this; } public function getEbDaysBefore(): ?int { return $this->ebDaysBefore; } public function setEbDaysBefore(?int $ebDaysBefore): self { $this->ebDaysBefore = $ebDaysBefore; return $this; } public function getPromoType(): ?int { return $this->promoType; } public function getPromoTypeFlag(): ?string { if($this->promoType == 1 or $this->promoType == 2){ return "Entities.Promo.FieldsValues.PromoTypeFlagEarlyBooking"; }elseif ($this->promoType==3){ return "Entities.Promo.FieldsValues.PromoTypeFlagSPO"; // special offer } return "Entities.Promo.FieldsValues.PromoTypeFlagPromo"; } public function setPromoType(int $promoType): self { $this->promoType = $promoType; return $this; } public function getMinStay(): ?int { return $this->minStay; } public function setMinStay(?int $minStay): self { $this->minStay = $minStay; return $this; } public function getMaxStay(): ?int { return $this->maxStay; } public function setMaxStay(?int $maxStay): self { $this->maxStay = $maxStay; return $this; } public function getHotelContract(): ?HotelContract { return $this->hotelContract; } public function setHotelContract(?HotelContract $hotelContract): self { $this->hotelContract = $hotelContract; return $this; } /** * @return Collection<int, HotelRoomTypeArrangement> */ public function getHrtaCombinations(): Collection { return $this->hrtaCombinations; } public function addHrtaCombination(HotelRoomTypeArrangement $hrtaCombination): self { if (!$this->hrtaCombinations->contains($hrtaCombination)) { $this->hrtaCombinations->add($hrtaCombination); } return $this; } public function removeHrtaCombination(HotelRoomTypeArrangement $hrtaCombination): self { $this->hrtaCombinations->removeElement($hrtaCombination); return $this; } public function __toString(): string { return $this->title; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; }}