Files
myep/src/Entity/Groups/ContingentDay.php
T

100 lines
2.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Entity\Groups;
use App\BpnConnect\Model\ContingentStatus;
use App\Repository\Groups\ContingentDayRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* Local snapshot of a single day of contingent availability as reported by bpn-connect.
*
* Keyed by hotel code, not by accommodation: the snapshot also covers TYPO3's calendar hotels,
* which have no `Accommodation`.
*
* Written exclusively by the scheduled sync, never by a user, hence no Blameable/Timestampable.
*/
#[ORM\Entity(repositoryClass: ContingentDayRepository::class)]
#[ORM\Table(name: 'contingent_day')]
#[ORM\UniqueConstraint(name: 'uniq_contingent_day_hotel_code_date', columns: ['hotel_code', 'date'])]
class ContingentDay
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 16)]
private ?string $hotelCode = null;
/**
* Superseded by $hotelCode and no longer written. Only rows from before the switch still
* carry it; it stays mapped until the column is dropped, so the switch can be rolled back.
*/
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: true, onDelete: 'CASCADE')]
private ?Accommodation $accommodation = null;
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
private ?\DateTimeImmutable $date = null;
#[ORM\Column(length: 20, enumType: ContingentStatus::class)]
private ContingentStatus $status = ContingentStatus::Blocked;
public function getId(): ?int
{
return $this->id;
}
public function getHotelCode(): ?string
{
return $this->hotelCode;
}
public function setHotelCode(string $hotelCode): self
{
$this->hotelCode = $hotelCode;
return $this;
}
public function getAccommodation(): ?Accommodation
{
return $this->accommodation;
}
public function setAccommodation(?Accommodation $accommodation): self
{
$this->accommodation = $accommodation;
return $this;
}
public function getDate(): ?\DateTimeImmutable
{
return $this->date;
}
public function setDate(\DateTimeImmutable $date): self
{
$this->date = $date;
return $this;
}
public function getStatus(): ContingentStatus
{
return $this->status;
}
public function setStatus(ContingentStatus $status): self
{
$this->status = $status;
return $this;
}
}