src/Entity/Gos/CouponCascadeSettings.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. /**
  7.  * @ORM\Entity()
  8.  * @ORM\HasLifecycleCallbacks()
  9.  */
  10. class CouponCascadeSettings
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\OneToOne(targetEntity="Coupon", inversedBy="cascadeSettings")
  20.      */
  21.     private $coupon;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity="CouponCascadeType", inversedBy="cascadeSettings")
  24.      */
  25.     private $type;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity="CouponCascadeMethod", inversedBy="cascadeSettings")
  28.      */
  29.     private $method;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity="CouponCascadeStep", mappedBy="cascadeSettings", cascade={"persist"})
  32.      */
  33.     private $steps;
  34.     /**
  35.      * @ORM\Column(type="datetime")
  36.      */
  37.     private $createdAt;
  38.     /**
  39.      * @ORM\Column(type="datetime", nullable=true)
  40.      */
  41.     private $updatedAt;
  42.     public function __construct()
  43.     {
  44.         $this->steps = new ArrayCollection();
  45.     }
  46.     /** @ORM\PrePersist() */
  47.     public function prePersist()
  48.     {
  49.         $this->createdAt = new \DateTime();
  50.     }
  51.     /** @ORM\PreUpdate() */
  52.     public function preUpdate()
  53.     {
  54.         $this->updatedAt = new \DateTime();
  55.     }
  56.     public function getId(): ?int
  57.     {
  58.         return $this->id;
  59.     }
  60.     public function getCreatedAt(): ?\DateTimeInterface
  61.     {
  62.         return $this->createdAt;
  63.     }
  64.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  65.     {
  66.         $this->createdAt $createdAt;
  67.         return $this;
  68.     }
  69.     public function getUpdatedAt(): ?\DateTimeInterface
  70.     {
  71.         return $this->updatedAt;
  72.     }
  73.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  74.     {
  75.         $this->updatedAt $updatedAt;
  76.         return $this;
  77.     }
  78.     public function getType(): ?CouponCascadeType
  79.     {
  80.         return $this->type;
  81.     }
  82.     public function setType(?CouponCascadeType $type): self
  83.     {
  84.         $this->type $type;
  85.         return $this;
  86.     }
  87.     public function getMethod(): ?CouponCascadeMethod
  88.     {
  89.         return $this->method;
  90.     }
  91.     public function setMethod(?CouponCascadeMethod $method): self
  92.     {
  93.         $this->method $method;
  94.         return $this;
  95.     }
  96.     /**
  97.      * @return Collection|CouponCascadeStep[]
  98.      */
  99.     public function getSteps(): Collection
  100.     {
  101.         return $this->steps;
  102.     }
  103.     public function addStep(CouponCascadeStep $step): self
  104.     {
  105.         if (!$this->steps->contains($step)) {
  106.             $this->steps[] = $step;
  107.             $step->setCascadeSettings($this);
  108.         }
  109.         return $this;
  110.     }
  111.     public function removeStep(CouponCascadeStep $step): self
  112.     {
  113.         if ($this->steps->contains($step)) {
  114.             $this->steps->removeElement($step);
  115.             // set the owning side to null (unless already changed)
  116.             if ($step->getCascadeSettings() === $this) {
  117.                 $step->setCascadeSettings(null);
  118.             }
  119.         }
  120.         return $this;
  121.     }
  122.     public function getCoupon(): ?Coupon
  123.     {
  124.         return $this->coupon;
  125.     }
  126.     public function setCoupon(?Coupon $coupon): self
  127.     {
  128.         $this->coupon $coupon;
  129.         return $this;
  130.     }
  131. }