src/Entity/Space.php line 16

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