src/Entity/Extra.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\TranslatableLocale;
  4. use App\Repository\ExtraRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use Gedmo\Translatable\Translatable;
  10. /**
  11.  * @ORM\Entity(repositoryClass=ExtraRepository::class)
  12.  */
  13. class Extra
  14. {
  15.     use TranslatableLocale;
  16.     
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @Gedmo\Translatable
  25.      * @ORM\Column(type="string", length=255)
  26.      */
  27.     private $label;
  28.     /**
  29.      * @Gedmo\Translatable
  30.      * @ORM\Column(type="text", nullable=true)
  31.      */
  32.     private $description;
  33.     /**
  34.      * @ORM\Column(type="integer")
  35.      */
  36.     private $price;
  37.     /**
  38.      * @Gedmo\Translatable
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private $placeholderCommentary;
  42.     /**
  43.      * @ORM\Column(type="boolean")
  44.      */
  45.     private $enablePrivatisation;
  46.     /**
  47.      * @ORM\Column(type="boolean")
  48.      */
  49.     private $enableReservation;
  50.     /**
  51.      * @ORM\Column(type="boolean")
  52.      */
  53.     private $enableCarteCadeau;
  54.     /**
  55.      * @ORM\OneToMany(targetEntity=OptionSelect::class, mappedBy="extra", orphanRemoval=true, cascade={"persist"})
  56.      */
  57.     private $optionSelects;
  58.     /**
  59.      * @ORM\OneToMany(targetEntity=OptionQuantity::class, mappedBy="extra", orphanRemoval=true, cascade={"persist"})
  60.      */
  61.     private $optionQuantities;
  62.     /**
  63.      * @ORM\OneToMany(targetEntity=ExtraReservation::class, mappedBy="extra")
  64.      */
  65.     private $extraReservations;
  66.     /**
  67.      * @ORM\Column(type="float", nullable=true)
  68.      */
  69.     private $tvaRatio;
  70.     /**
  71.      * @ORM\Column(type="boolean")
  72.      */
  73.     private $singleObject;
  74.     /**
  75.      * @Gedmo\Translatable
  76.      * @ORM\Column(type="string", length=255, nullable=true)
  77.      */
  78.     private $labelButtonAdd;
  79.     /**
  80.      * @var \DateTime $created
  81.      * 
  82.      * @Gedmo\Timestampable(on="create")
  83.      * @ORM\Column(type="datetime", nullable=true)
  84.      */
  85.     private $created;
  86.     /**
  87.      * @var \DateTime $updated
  88.      *
  89.      * @Gedmo\Timestampable(on="update")
  90.      * @ORM\Column(type="datetime", nullable=true)
  91.      */
  92.     private $updated;
  93.     public function __construct()
  94.     {
  95.         $this->optionSelects = new ArrayCollection();
  96.         $this->optionQuantities = new ArrayCollection();
  97.         $this->extraReservations = new ArrayCollection();
  98.     }
  99.     public function getId(): ?int
  100.     {
  101.         return $this->id;
  102.     }
  103.     public function getLabel(): ?string
  104.     {
  105.         return $this->label;
  106.     }
  107.     public function setLabel(string $label): self
  108.     {
  109.         $this->label $label;
  110.         return $this;
  111.     }
  112.     public function getDescription(): ?string
  113.     {
  114.         return $this->description;
  115.     }
  116.     public function setDescription(?string $description): self
  117.     {
  118.         $this->description $description;
  119.         return $this;
  120.     }
  121.     public function getPrice(): ?float
  122.     {
  123.         return $this->price 100;
  124.     }
  125.     public function setPrice(int $price): self
  126.     {
  127.         $this->price $price;
  128.         return $this;
  129.     }
  130.     public function getPlaceholderCommentary(): ?string
  131.     {
  132.         return $this->placeholderCommentary;
  133.     }
  134.     public function setPlaceholderCommentary(?string $placeholderCommentary): self
  135.     {
  136.         $this->placeholderCommentary $placeholderCommentary;
  137.         return $this;
  138.     }
  139.     public function isEnablePrivatisation(): ?bool
  140.     {
  141.         return $this->enablePrivatisation;
  142.     }
  143.     public function setEnablePrivatisation(bool $enablePrivatisation): self
  144.     {
  145.         $this->enablePrivatisation $enablePrivatisation;
  146.         return $this;
  147.     }
  148.     public function isEnableReservation(): ?bool
  149.     {
  150.         return $this->enableReservation;
  151.     }
  152.     public function setEnableReservation(bool $enableReservation): self
  153.     {
  154.         $this->enableReservation $enableReservation;
  155.         return $this;
  156.     }
  157.     /**
  158.      * @return Collection<int, OptionSelect>
  159.      */
  160.     public function getOptionSelects(): Collection
  161.     {
  162.         return $this->optionSelects;
  163.     }
  164.     /**
  165.      * @return Collection<int, OptionSelect>
  166.      */
  167.     public function getActiveOptionSelects(): Collection
  168.     {
  169.         return $this->optionSelects->filter(function(OptionSelect $optionSelect) {
  170.             return !$optionSelect->isDeleted();
  171.         });
  172.     }
  173.     public function addOptionSelect(OptionSelect $optionSelect): self
  174.     {
  175.         if (!$this->optionSelects->contains($optionSelect)) {
  176.             $this->optionSelects[] = $optionSelect;
  177.             $optionSelect->setExtra($this);
  178.         }
  179.         return $this;
  180.     }
  181.     public function removeOptionSelect(OptionSelect $optionSelect): self
  182.     {
  183.         if ($this->optionSelects->removeElement($optionSelect)) {
  184.             // set the owning side to null (unless already changed)
  185.             if ($optionSelect->getExtra() === $this) {
  186.                 $optionSelect->setExtra(null);
  187.             }
  188.         }
  189.         return $this;
  190.     }
  191.     /**
  192.      * @return Collection<int, OptionQuantity>
  193.      */
  194.     public function getOptionQuantities(): Collection
  195.     {
  196.         return $this->optionQuantities;
  197.     }
  198.     /**
  199.      * @return Collection<int, OptionQuantity>
  200.      */
  201.     public function getActiveOptionQuantities(): Collection
  202.     {
  203.         return $this->optionQuantities->filter(function(OptionQuantity $optionQuantity) {
  204.             return !$optionQuantity->isDeleted();
  205.         });
  206.     }
  207.     public function addOptionQuantity(OptionQuantity $optionQuantity): self
  208.     {
  209.         if (!$this->optionQuantities->contains($optionQuantity)) {
  210.             $this->optionQuantities[] = $optionQuantity;
  211.             $optionQuantity->setExtra($this);
  212.         }
  213.         return $this;
  214.     }
  215.     public function removeOptionQuantity(OptionQuantity $optionQuantity): self
  216.     {
  217.         if ($this->optionQuantities->removeElement($optionQuantity)) {
  218.             // set the owning side to null (unless already changed)
  219.             if ($optionQuantity->getExtra() === $this) {
  220.                 $optionQuantity->setExtra(null);
  221.             }
  222.         }
  223.         return $this;
  224.     }
  225.     /**
  226.      * @return Collection<int, ExtraReservation>
  227.      */
  228.     public function getExtraReservations(): Collection
  229.     {
  230.         return $this->extraReservations;
  231.     }
  232.     public function addExtraReservation(ExtraReservation $extraReservation): self
  233.     {
  234.         if (!$this->extraReservations->contains($extraReservation)) {
  235.             $this->extraReservations[] = $extraReservation;
  236.             $extraReservation->setExtra($this);
  237.         }
  238.         return $this;
  239.     }
  240.     public function removeExtraReservation(ExtraReservation $extraReservation): self
  241.     {
  242.         if ($this->extraReservations->removeElement($extraReservation)) {
  243.             // set the owning side to null (unless already changed)
  244.             if ($extraReservation->getExtra() === $this) {
  245.                 $extraReservation->setExtra(null);
  246.             }
  247.         }
  248.         return $this;
  249.     }
  250.     public function getTvaRatio(): ?float
  251.     {
  252.         return $this->tvaRatio;
  253.     }
  254.     public function setTvaRatio(?float $tvaRatio): self
  255.     {
  256.         $this->tvaRatio $tvaRatio;
  257.         return $this;
  258.     }
  259.     public function isSingleObject(): ?bool
  260.     {
  261.         return $this->singleObject;
  262.     }
  263.     public function setSingleObject(bool $singleObject): self
  264.     {
  265.         $this->singleObject $singleObject;
  266.         return $this;
  267.     }
  268.     public function getLabelButtonAdd(): ?string
  269.     {
  270.         return $this->labelButtonAdd;
  271.     }
  272.     public function setLabelButtonAdd(?string $labelButtonAdd): self
  273.     {
  274.         $this->labelButtonAdd $labelButtonAdd;
  275.         return $this;
  276.     }
  277.     public function getEntitiesToRefresh(): array
  278.     {
  279.         $entitiesToRefresh = [];
  280.         $entitiesToRefresh[] = $this;
  281.         
  282.         foreach($this->getOptionSelects() as $optionSelect) {
  283.             $entitiesToRefresh array_merge($entitiesToRefresh$optionSelect->getEntitiesToRefresh());
  284.         }
  285.         foreach($this->getOptionQuantities() as $optionQuantity) {
  286.             $entitiesToRefresh array_merge($entitiesToRefresh$optionQuantity->getEntitiesToRefresh());
  287.         }
  288.         return $entitiesToRefresh;
  289.     }
  290.     public function isEnableCarteCadeau(): ?bool
  291.     {
  292.         return $this->enableCarteCadeau;
  293.     }
  294.     public function setEnableCarteCadeau(?bool $enableCarteCadeau): self
  295.     {
  296.         $this->enableCarteCadeau $enableCarteCadeau;
  297.         return $this;
  298.     }
  299. }