src/Entity/SubscriptionPlan.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SubscriptionPlanRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=SubscriptionPlanRepository::class)
  9.  */
  10. class SubscriptionPlan
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $subscription_plan_name;
  22.     /**
  23.      * @ORM\Column(type="boolean")
  24.      */
  25.     private $is_active;
  26.     /**
  27.      * @ORM\Column(type="integer", nullable=true)
  28.      */
  29.     private $reg_by;
  30.     /**
  31.      * @ORM\Column(type="datetime", nullable=true)
  32.      */
  33.     private $reg_datetime;
  34.     /**
  35.      * @ORM\ManyToMany(targetEntity=Product::class, mappedBy="subscription_plan")
  36.      */
  37.     private $products;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=SubscriptionPlanPrice::class, mappedBy="subscription_plan")
  40.      */
  41.     private $subscriptionPlanPrices;
  42.     public function __construct()
  43.     {
  44.         $this->products = new ArrayCollection();
  45.         $this->subscriptionPlanPrices = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getSubscriptionPlanName(): ?string
  52.     {
  53.         return $this->subscription_plan_name;
  54.     }
  55.     public function setSubscriptionPlanName(string $subscription_plan_name): self
  56.     {
  57.         $this->subscription_plan_name $subscription_plan_name;
  58.         return $this;
  59.     }
  60.     public function isIsActive(): ?bool
  61.     {
  62.         return $this->is_active;
  63.     }
  64.     public function setIsActive(bool $is_active): self
  65.     {
  66.         $this->is_active $is_active;
  67.         return $this;
  68.     }
  69.     public function getRegBy(): ?int
  70.     {
  71.         return $this->reg_by;
  72.     }
  73.     public function setRegBy(?int $reg_by): self
  74.     {
  75.         $this->reg_by $reg_by;
  76.         return $this;
  77.     }
  78.     public function getRegDatetime(): ?\DateTimeInterface
  79.     {
  80.         return $this->reg_datetime;
  81.     }
  82.     public function setRegDatetime(?\DateTimeInterface $reg_datetime): self
  83.     {
  84.         $this->reg_datetime $reg_datetime;
  85.         return $this;
  86.     }
  87.     public function __toString()
  88.     {
  89.         return $this->getSubscriptionPlanName();
  90.     }
  91.     /**
  92.      * @return Collection<int, Product>
  93.      */
  94.     public function getProducts(): Collection
  95.     {
  96.         return $this->products;
  97.     }
  98.     public function addProduct(Product $product): self
  99.     {
  100.         if (!$this->products->contains($product)) {
  101.             $this->products[] = $product;
  102.             $product->addSubscriptionPlan($this);
  103.         }
  104.         return $this;
  105.     }
  106.     public function removeProduct(Product $product): self
  107.     {
  108.         if ($this->products->removeElement($product)) {
  109.             $product->removeSubscriptionPlan($this);
  110.         }
  111.         return $this;
  112.     }
  113.     /**
  114.      * @return Collection<int, SubscriptionPlanPrice>
  115.      */
  116.     public function getSubscriptionPlanPrices(): Collection
  117.     {
  118.         return $this->subscriptionPlanPrices;
  119.     }
  120.     public function addSubscriptionPlanPrice(SubscriptionPlanPrice $subscriptionPlanPrice): self
  121.     {
  122.         if (!$this->subscriptionPlanPrices->contains($subscriptionPlanPrice)) {
  123.             $this->subscriptionPlanPrices[] = $subscriptionPlanPrice;
  124.             $subscriptionPlanPrice->setSubscriptionPlan($this);
  125.         }
  126.         return $this;
  127.     }
  128.     public function removeSubscriptionPlanPrice(SubscriptionPlanPrice $subscriptionPlanPrice): self
  129.     {
  130.         if ($this->subscriptionPlanPrices->removeElement($subscriptionPlanPrice)) {
  131.             // set the owning side to null (unless already changed)
  132.             if ($subscriptionPlanPrice->getSubscriptionPlan() === $this) {
  133.                 $subscriptionPlanPrice->setSubscriptionPlan(null);
  134.             }
  135.         }
  136.         return $this;
  137.     }
  138. }