219 lines
5.1 KiB
PHP
219 lines
5.1 KiB
PHP
<?php
|
|
|
|
namespace App\Entity\Groups;
|
|
|
|
use App\Entity\BlameableEntity;
|
|
use App\Entity\BlameableEntityInterface;
|
|
use App\Entity\TimestampableEntity;
|
|
use App\Entity\TimestampableEntityInterface;
|
|
use App\Enum\Groups\Season;
|
|
use App\Repository\Groups\AccommodationPriceRepository;
|
|
use Doctrine\DBAL\Types\Types;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
#[ORM\Entity(repositoryClass: AccommodationPriceRepository::class)]
|
|
class AccommodationPrice implements BlameableEntityInterface, TimestampableEntityInterface
|
|
{
|
|
use BlameableEntity;
|
|
use TimestampableEntity;
|
|
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'accommodationPrices')]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private ?Accommodation $accommodation = null;
|
|
|
|
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
|
#[Assert\NotNull(message: 'required')]
|
|
private ?\DateTimeImmutable $dateFrom = null;
|
|
|
|
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
|
#[Assert\NotNull(message: 'required')]
|
|
#[Assert\GreaterThan(propertyPath: 'dateFrom', message: 'Das Bis-Datum muss nach dem Von-Datum liegen')]
|
|
private ?\DateTimeImmutable $dateTo = null;
|
|
|
|
#[ORM\Column(length: 20, enumType: Season::class)]
|
|
private ?Season $season = null;
|
|
|
|
#[ORM\Column]
|
|
#[Assert\NotNull(message: 'required')]
|
|
private ?int $includedPax = null;
|
|
|
|
#[ORM\Column]
|
|
#[Assert\NotNull(message: 'required')]
|
|
private ?int $pricePerNight = null;
|
|
|
|
#[ORM\Column]
|
|
#[Assert\NotNull(message: 'required')]
|
|
private ?int $priceAdditionalPerson = null;
|
|
|
|
#[ORM\Column]
|
|
#[Assert\NotNull(message: 'required')]
|
|
private ?int $minNights = null;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?int $pricePerNightOverride = null;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?int $priceAdditionalPersonOverride = null;
|
|
|
|
#[ORM\Column]
|
|
private bool $acceptUndersubscription = false;
|
|
|
|
public function __clone()
|
|
{
|
|
$this->id = null;
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getAccommodation(): ?Accommodation
|
|
{
|
|
return $this->accommodation;
|
|
}
|
|
|
|
public function setAccommodation(?Accommodation $accommodation): self
|
|
{
|
|
$this->accommodation = $accommodation;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDateFrom(): ?\DateTimeImmutable
|
|
{
|
|
return $this->dateFrom;
|
|
}
|
|
|
|
public function setDateFrom(\DateTimeImmutable $dateFrom): self
|
|
{
|
|
$this->dateFrom = $dateFrom;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDateTo(): ?\DateTimeImmutable
|
|
{
|
|
return $this->dateTo;
|
|
}
|
|
|
|
public function setDateTo(\DateTimeImmutable $dateTo): self
|
|
{
|
|
$this->dateTo = $dateTo;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getSeason(): ?Season
|
|
{
|
|
return $this->season;
|
|
}
|
|
|
|
public function setSeason(?Season $season): self
|
|
{
|
|
$this->season = $season;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getIncludedPax(): ?int
|
|
{
|
|
return $this->includedPax;
|
|
}
|
|
|
|
public function setIncludedPax(int $includedPax): self
|
|
{
|
|
$this->includedPax = $includedPax;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPricePerNight(): ?int
|
|
{
|
|
return $this->pricePerNight;
|
|
}
|
|
|
|
public function setPricePerNight(int $pricePerNight): self
|
|
{
|
|
$this->pricePerNight = $pricePerNight;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPriceAdditionalPerson(): ?int
|
|
{
|
|
return $this->priceAdditionalPerson;
|
|
}
|
|
|
|
public function setPriceAdditionalPerson(int $priceAdditionalPerson): self
|
|
{
|
|
$this->priceAdditionalPerson = $priceAdditionalPerson;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getMinNights(): ?int
|
|
{
|
|
return $this->minNights;
|
|
}
|
|
|
|
public function setMinNights(int $minNights): self
|
|
{
|
|
$this->minNights = $minNights;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPricePerNightOverride(): ?int
|
|
{
|
|
return $this->pricePerNightOverride;
|
|
}
|
|
|
|
public function setPricePerNightOverride(?int $pricePerNightOverride): self
|
|
{
|
|
$this->pricePerNightOverride = $pricePerNightOverride;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getEffectivePricePerNight(): int
|
|
{
|
|
return $this->pricePerNightOverride ?? $this->pricePerNight;
|
|
}
|
|
|
|
public function getPriceAdditionalPersonOverride(): ?int
|
|
{
|
|
return $this->priceAdditionalPersonOverride;
|
|
}
|
|
|
|
public function setPriceAdditionalPersonOverride(?int $priceAdditionalPersonOverride): self
|
|
{
|
|
$this->priceAdditionalPersonOverride = $priceAdditionalPersonOverride;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getEffectivePriceAdditionalPerson(): int
|
|
{
|
|
return $this->priceAdditionalPersonOverride ?? $this->priceAdditionalPerson;
|
|
}
|
|
|
|
public function isAcceptUndersubscription(): bool
|
|
{
|
|
return $this->acceptUndersubscription;
|
|
}
|
|
|
|
public function setAcceptUndersubscription(bool $acceptUndersubscription): self
|
|
{
|
|
$this->acceptUndersubscription = $acceptUndersubscription;
|
|
|
|
return $this;
|
|
}
|
|
}
|