src/Entity/Gos/CouponCascadeMethod.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 CouponCascadeMethod
  11. {
  12.     const PriceOverall 'price-overall';
  13.     const ProductsSeparately 'products-separately';
  14.     /**
  15.      * @ORM\Id()
  16.      * @ORM\GeneratedValue()
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255, nullable=true)
  22.      */
  23.     private $name;
  24.     /**
  25.      * @Gedmo\Slug(fields={"name"})
  26.      * @ORM\Column(type="string", length=255, nullable=true)
  27.      */
  28.     private $slug;
  29.     /**
  30.      * @ORM\OneToMany(targetEntity="CouponCascadeSettings", mappedBy="method")
  31.      */
  32.     private $cascadeSettings;
  33.     public function __construct()
  34.     {
  35.         $this->cascadeSettings = new ArrayCollection();
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getName(): ?string
  42.     {
  43.         return $this->name;
  44.     }
  45.     public function setName(?string $name): self
  46.     {
  47.         $this->name $name;
  48.         return $this;
  49.     }
  50.     public function getSlug(): ?string
  51.     {
  52.         return $this->slug;
  53.     }
  54.     public function setSlug(string $slug): self
  55.     {
  56.         $this->slug $slug;
  57.         return $this;
  58.     }
  59.     /**
  60.      * @return Collection|CouponCascadeSettings[]
  61.      */
  62.     public function getCascadeSettings(): Collection
  63.     {
  64.         return $this->cascadeSettings;
  65.     }
  66.     public function addCascadeSetting(CouponCascadeSettings $cascadeSetting): self
  67.     {
  68.         if (!$this->cascadeSettings->contains($cascadeSetting)) {
  69.             $this->cascadeSettings[] = $cascadeSetting;
  70.             $cascadeSetting->setMethod($this);
  71.         }
  72.         return $this;
  73.     }
  74.     public function removeCascadeSetting(CouponCascadeSettings $cascadeSetting): self
  75.     {
  76.         if ($this->cascadeSettings->contains($cascadeSetting)) {
  77.             $this->cascadeSettings->removeElement($cascadeSetting);
  78.             // set the owning side to null (unless already changed)
  79.             if ($cascadeSetting->getMethod() === $this) {
  80.                 $cascadeSetting->setMethod(null);
  81.             }
  82.         }
  83.         return $this;
  84.     }
  85. }