src/Entity/Core/Pricing.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * Pricing
  6. *
  7. * @ORM\Table("core_pricings", uniqueConstraints={
  8. * @ORM\UniqueConstraint(name="UNIQ_PRICING_ROOMS_PERSONS_SEASON", columns={"rooms","persons","season"})
  9. * })
  10. * @ORM\Entity(repositoryClass="App\Repository\Core\PricingRepository")
  11. * @ORM\HasLifecycleCallbacks()
  12. */
  13. class Pricing
  14. {
  15. public const SEASON_LOW = 'low';
  16. public const SEASON_HIGH = 'high';
  17. /**
  18. * @var integer
  19. *
  20. * @ORM\Column(name="id", type="integer")
  21. * @ORM\Id
  22. * @ORM\GeneratedValue(strategy="AUTO")
  23. */
  24. protected $id;
  25. /**
  26. * @ORM\Column(name="created_at", type="datetime", nullable=true)
  27. */
  28. private $createdAt;
  29. /**
  30. * @ORM\Column(name="updated_at", type="datetime", nullable=true)
  31. */
  32. private $updatedAt;
  33. /**
  34. * @ORM\Column(name="rooms", type="integer")
  35. */
  36. private $rooms;
  37. /**
  38. * @ORM\Column(name="persons", type="integer")
  39. */
  40. private $persons;
  41. /**
  42. * @ORM\Column(name="season", type="string", length=10, options={"default" : "low"})
  43. */
  44. private $season = self::SEASON_LOW;
  45. /**
  46. * @ORM\Column(name="price", type="float")
  47. */
  48. private $price;
  49. /**
  50. * @ORM\PrePersist
  51. */
  52. public function setCreatedAtValue(): void
  53. {
  54. $this->setCreatedAt(new \DateTime("now"));
  55. $this->setUpdatedAt(new \DateTime("now"));
  56. }
  57. /**
  58. * @ORM\PreUpdate
  59. */
  60. public function setUpdatedAtValue(): void
  61. {
  62. $this->setUpdatedAt(new \DateTime("now"));
  63. }
  64. public function __toString(): string
  65. {
  66. return $this->rooms . ' ch / ' . $this->persons . ' pers (' . $this->season . ')';
  67. }
  68. public function getId(): ?int { return $this->id; }
  69. public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; }
  70. public function setCreatedAt(?\DateTimeInterface $d): static { $this->createdAt = $d; return $this; }
  71. public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; }
  72. public function setUpdatedAt(?\DateTimeInterface $d): static { $this->updatedAt = $d; return $this; }
  73. public function getRooms(): ?int { return $this->rooms; }
  74. public function setRooms(int $v): static { $this->rooms = $v; return $this; }
  75. public function getPersons(): ?int { return $this->persons; }
  76. public function setPersons(int $v): static { $this->persons = $v; return $this; }
  77. public function getSeason(): ?string { return $this->season; }
  78. public function setSeason(string $v): static { $this->season = $v; return $this; }
  79. public function getPrice(): ?float { return $this->price; }
  80. public function setPrice(float $v): static { $this->price = $v; return $this; }
  81. }