<?phpnamespace App\Entity;use App\Repository\StopsaleHotelRepository;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: StopsaleHotelRepository::class)]class StopsaleHotel{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\ManyToOne] #[ORM\JoinColumn(nullable: false)] private ?Market $market = null; #[ORM\ManyToOne(inversedBy: 'stopsales')] #[ORM\JoinColumn(nullable: false)] private ?HotelContract $hotelContract = null; #[Assert\NotNull] #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)] private ?DateTimeInterface $startDate = null; #[Assert\NotNull] #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)] private ?DateTimeInterface $endDate = null; #[ORM\ManyToMany(targetEntity: HotelRoomTypeArrangement::class)] private Collection $combinations; public function __construct() { $this->combinations = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getHotelContract(): ?HotelContract { return $this->hotelContract; } public function setHotelContract(?HotelContract $hotelContract): self { $this->hotelContract = $hotelContract; return $this; } public function getMarket(): ?Market { return $this->market; } public function setMarket(?Market $market): self { $this->market = $market; return $this; } public function getStartDate(): ?DateTimeInterface { return $this->startDate; } public function setStartDate(?DateTimeInterface $startDate): self { $this->startDate = $startDate; return $this; } public function getEndDate(): ?DateTimeInterface { return $this->endDate; } public function setEndDate(?DateTimeInterface $endDate): self { $this->endDate = $endDate; return $this; } /** * @return Collection<int, HotelRoomTypeArrangement> */ public function getCombinations(): Collection { return $this->combinations; } public function addCombination(HotelRoomTypeArrangement $combination): self { if (!$this->combinations->contains($combination)) { $this->combinations->add($combination); } return $this; } public function removeCombination(HotelRoomTypeArrangement $combination): self { $this->combinations->removeElement($combination); return $this; } public function __toString(): string { return 'StopSale '.$this->startDate->format('d/m/y').' TO '.$this->endDate->format('d/m/y'); }}