src/Entity/Space.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\MDS\VenuesBundle\Entity\ReservationLoungeDetails;
  4. use App\Repository\SpaceRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. #[ORM\Entity(repositoryClass: SpaceRepository::class)]
  10. class Space
  11. {
  12. #[ORM\Id]
  13. #[ORM\GeneratedValue]
  14. #[ORM\Column(type: 'integer')]
  15. private $id;
  16. #[ORM\Column(type: 'string', length: 255)]
  17. private $name;
  18. #[ORM\Column(type: 'string', length: 10, nullable: true)]
  19. private $billingSeries;
  20. #[ORM\Column(type: 'boolean')]
  21. private $isMain;
  22. #[ORM\OneToMany(targetEntity: ReservationLoungeDetails::class, mappedBy: 'space', cascade: ['persist'], orphanRemoval: false)]
  23. private $ReservationLounges;
  24. #[ORM\Column(type: 'string', length: 10, nullable: true)]
  25. private $rectifyingBillingSeries;
  26. /**
  27. * IVA en porcentaje (0–100)
  28. */
  29. #[ORM\Column(type: 'decimal', precision: 5, scale: 2, nullable: true)]
  30. #[Assert\Range(min: 0, max: 100, notInRangeMessage: 'El IVA debe estar entre 0 y 100.')]
  31. private $iva;
  32. public function __construct()
  33. {
  34. $this->ReservationLounges = new ArrayCollection();
  35. }
  36. public function getId(): ?int
  37. {
  38. return $this->id;
  39. }
  40. public function getName(): ?string
  41. {
  42. return $this->name;
  43. }
  44. public function setName(string $name): self
  45. {
  46. $this->name = $name;
  47. return $this;
  48. }
  49. public function getBillingSeries(): ?string
  50. {
  51. return $this->billingSeries;
  52. }
  53. public function setBillingSeries(?string $billingSeries): self
  54. {
  55. $this->billingSeries = $billingSeries;
  56. return $this;
  57. }
  58. public function isIsMain(): ?bool
  59. {
  60. return $this->isMain;
  61. }
  62. public function setIsMain(bool $isMain): self
  63. {
  64. $this->isMain = $isMain;
  65. return $this;
  66. }
  67. /**
  68. * @return Collection<int, ReservationLoungeDetails>
  69. */
  70. public function getReservationLounges(): Collection
  71. {
  72. return $this->ReservationLounges;
  73. }
  74. public function addReservationLounge(ReservationLoungeDetails $reservationLounge): self
  75. {
  76. if (!$this->ReservationLounges->contains($reservationLounge)) {
  77. $this->ReservationLounges[] = $reservationLounge;
  78. $reservationLounge->setSpace($this);
  79. }
  80. return $this;
  81. }
  82. public function removeReservationLounge(ReservationLoungeDetails $reservationLounge): self
  83. {
  84. if ($this->ReservationLounges->removeElement($reservationLounge)) {
  85. // set the owning side to null (unless already changed)
  86. if ($reservationLounge->getSpace() === $this) {
  87. $reservationLounge->setSpace(null);
  88. }
  89. }
  90. return $this;
  91. }
  92. public function getRectifyingBillingSeries(): ?string
  93. {
  94. return $this->rectifyingBillingSeries;
  95. }
  96. public function setRectifyingBillingSeries(?string $rectifyingBillingSeries): self
  97. {
  98. $this->rectifyingBillingSeries = $rectifyingBillingSeries;
  99. return $this;
  100. }
  101. public function getIva(): ?float
  102. {
  103. // Doctrine devuelve string para DECIMAL: lo convertimos a float
  104. return $this->iva !== null ? (float) $this->iva : null;
  105. }
  106. public function setIva(?float $iva): self
  107. {
  108. $this->iva = $iva;
  109. return $this;
  110. }
  111. }