feat: groups price calculator admin crud, booking/offer flow and api
This commit is contained in:
@@ -0,0 +1,211 @@
|
||||
<?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\PriceType;
|
||||
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;
|
||||
|
||||
// Inclusive: the last night this price applies.
|
||||
// A booking 01.01.–10.01. covers 9 nights (01.01.–09.01.), 10.01. is checkout.
|
||||
#[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(length: 20, nullable: true, enumType: PriceType::class)]
|
||||
private ?PriceType $type = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private bool $acceptUndersubscription = false;
|
||||
|
||||
#[ORM\Column]
|
||||
private bool $acceptShortTerm = 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 getType(): ?PriceType
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setType(?PriceType $type): self
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isAcceptUndersubscription(): bool
|
||||
{
|
||||
return $this->acceptUndersubscription;
|
||||
}
|
||||
|
||||
public function setAcceptUndersubscription(bool $acceptUndersubscription): self
|
||||
{
|
||||
$this->acceptUndersubscription = $acceptUndersubscription;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isAcceptShortTerm(): bool
|
||||
{
|
||||
return $this->acceptShortTerm;
|
||||
}
|
||||
|
||||
public function setAcceptShortTerm(bool $acceptShortTerm): self
|
||||
{
|
||||
$this->acceptShortTerm = $acceptShortTerm;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user