src/Entity/Gos/CouponCascadeType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. /**
  8.  * @ORM\Entity()
  9.  */
  10. class CouponCascadeType
  11. {
  12.     const NetPrice 'net-price';
  13.     const GrossPrice 'gross-price';
  14.     const NumberOfProducts 'number-of-products';
  15.     /**
  16.      * @ORM\Id()
  17.      * @ORM\GeneratedValue()
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255, nullable=true)
  23.      */
  24.     private $name;
  25.     /**
  26.      * @Gedmo\Slug(fields={"name"})
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $slug;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity="CouponCascadeSettings", mappedBy="type")
  32.      */
  33.     private $cascadeSettings;
  34.     public function __construct()
  35.     {
  36.         $this->cascadeSettings = new ArrayCollection();
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getName(): ?string
  43.     {
  44.         return $this->name;
  45.     }
  46.     public function setName(?string $name): self
  47.     {
  48.         $this->name $name;
  49.         return $this;
  50.     }
  51.     public function getSlug(): ?string
  52.     {
  53.         return $this->slug;
  54.     }
  55.     public function setSlug(?string $slug): self
  56.     {
  57.         $this->slug $slug;
  58.         return $this;
  59.     }
  60.     /**
  61.      * @return Collection|CouponCascadeSettings[]
  62.      */
  63.     public function getCascadeSettings(): Collection
  64.     {
  65.         return $this->cascadeSettings;
  66.     }
  67.     public function addCascadeSetting(CouponCascadeSettings $cascadeSetting): self
  68.     {
  69.         if (!$this->cascadeSettings->contains($cascadeSetting)) {
  70.             $this->cascadeSettings[] = $cascadeSetting;
  71.             $cascadeSetting->setType($this);
  72.         }
  73.         return $this;
  74.     }
  75.     public function removeCascadeSetting(CouponCascadeSettings $cascadeSetting): self
  76.     {
  77.         if ($this->cascadeSettings->contains($cascadeSetting)) {
  78.             $this->cascadeSettings->removeElement($cascadeSetting);
  79.             // set the owning side to null (unless already changed)
  80.             if ($cascadeSetting->getType() === $this) {
  81.                 $cascadeSetting->setType(null);
  82.             }
  83.         }
  84.         return $this;
  85.     }
  86. }