<?phpnamespace App\Entity\Core;use Doctrine\ORM\Mapping as ORM;/** * Pricing * * @ORM\Table("core_pricings", uniqueConstraints={ * @ORM\UniqueConstraint(name="UNIQ_PRICING_ROOMS_PERSONS_SEASON", columns={"rooms","persons","season"}) * }) * @ORM\Entity(repositoryClass="App\Repository\Core\PricingRepository") * @ORM\HasLifecycleCallbacks() */class Pricing{ public const SEASON_LOW = 'low'; public const SEASON_HIGH = 'high'; /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\Column(name="created_at", type="datetime", nullable=true) */ private $createdAt; /** * @ORM\Column(name="updated_at", type="datetime", nullable=true) */ private $updatedAt; /** * @ORM\Column(name="rooms", type="integer") */ private $rooms; /** * @ORM\Column(name="persons", type="integer") */ private $persons; /** * @ORM\Column(name="season", type="string", length=10, options={"default" : "low"}) */ private $season = self::SEASON_LOW; /** * @ORM\Column(name="price", type="float") */ private $price; /** * @ORM\PrePersist */ public function setCreatedAtValue(): void { $this->setCreatedAt(new \DateTime("now")); $this->setUpdatedAt(new \DateTime("now")); } /** * @ORM\PreUpdate */ public function setUpdatedAtValue(): void { $this->setUpdatedAt(new \DateTime("now")); } public function __toString(): string { return $this->rooms . ' ch / ' . $this->persons . ' pers (' . $this->season . ')'; } public function getId(): ?int { return $this->id; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(?\DateTimeInterface $d): static { $this->createdAt = $d; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(?\DateTimeInterface $d): static { $this->updatedAt = $d; return $this; } public function getRooms(): ?int { return $this->rooms; } public function setRooms(int $v): static { $this->rooms = $v; return $this; } public function getPersons(): ?int { return $this->persons; } public function setPersons(int $v): static { $this->persons = $v; return $this; } public function getSeason(): ?string { return $this->season; } public function setSeason(string $v): static { $this->season = $v; return $this; } public function getPrice(): ?float { return $this->price; } public function setPrice(float $v): static { $this->price = $v; return $this; }}