src/Entity/OptionQuantity.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\AbstractOption;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Entity\Trait\TranslatableLocale;
  6. use Doctrine\Common\Collections\Collection;
  7. use App\Repository\OptionQuantityRepository;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. /**
  10.  * @ORM\Entity(repositoryClass=OptionQuantityRepository::class)
  11.  */
  12. class OptionQuantity extends AbstractOption
  13. {
  14.     use TranslatableLocale;
  15.     
  16.     /**
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $price;
  20.     /**
  21.      * @ORM\ManyToOne(targetEntity=Extra::class, inversedBy="optionQuantities")
  22.      * @ORM\JoinColumn(nullable=false)
  23.      */
  24.     private $extra;
  25.     /**
  26.      * @ORM\OneToMany(targetEntity=OptionQuantityReservation::class, mappedBy="optionQuantity")
  27.      */
  28.     private $optionQuantityReservations;
  29.     /**
  30.      * @ORM\Column(type="float", nullable=true)
  31.      */
  32.     private $tvaRatio;
  33.     public function __construct()
  34.     {
  35.         $this->optionQuantityReservations = new ArrayCollection();
  36.     }
  37.     public function getPrice(): ?float
  38.     {
  39.         return $this->price 100;
  40.     }
  41.     public function setPrice(int $price): self
  42.     {
  43.         $this->price $price;
  44.         return $this;
  45.     }
  46.     public function getExtra(): ?Extra
  47.     {
  48.         return $this->extra;
  49.     }
  50.     public function setExtra(?Extra $extra): self
  51.     {
  52.         $this->extra $extra;
  53.         return $this;
  54.     }
  55.     /**
  56.      * @return Collection<int, OptionQuantityReservation>
  57.      */
  58.     public function getOptionQuantityReservations(): Collection
  59.     {
  60.         return $this->optionQuantityReservations;
  61.     }
  62.     public function addOptionQuantityReservation(OptionQuantityReservation $optionQuantityReservation): self
  63.     {
  64.         if (!$this->optionQuantityReservations->contains($optionQuantityReservation)) {
  65.             $this->optionQuantityReservations[] = $optionQuantityReservation;
  66.             $optionQuantityReservation->setOptionQuantity($this);
  67.         }
  68.         return $this;
  69.     }
  70.     public function removeOptionQuantityReservation(OptionQuantityReservation $optionQuantityReservation): self
  71.     {
  72.         if ($this->optionQuantityReservations->removeElement($optionQuantityReservation)) {
  73.             // set the owning side to null (unless already changed)
  74.             if ($optionQuantityReservation->getOptionQuantity() === $this) {
  75.                 $optionQuantityReservation->setOptionQuantity(null);
  76.             }
  77.         }
  78.         return $this;
  79.     }
  80.     public function getTvaRatio(): ?float
  81.     {
  82.         return $this->tvaRatio;
  83.     }
  84.     public function setTvaRatio(?float $tvaRatio): self
  85.     {
  86.         $this->tvaRatio $tvaRatio;
  87.         return $this;
  88.     }
  89. }