src/Entity/Product.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ProductRepository::class)
  9.  */
  10. class Product
  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 $product_name;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $product_description_short;
  26.     /**
  27.      * @ORM\Column(type="text", nullable=true)
  28.      */
  29.     private $product_description_long;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $product_image;
  34.     /**
  35.      * @ORM\Column(type="boolean")
  36.      */
  37.     private $is_public;
  38.     /**
  39.      * @ORM\Column(type="boolean")
  40.      */
  41.     private $is_active;
  42.     /**
  43.      * @ORM\Column(type="integer", nullable=true)
  44.      */
  45.     private $reg_by;
  46.     /**
  47.      * @ORM\Column(type="datetime", nullable=true)
  48.      */
  49.     private $reg_datetime;
  50.     /**
  51.      * @ORM\OneToMany(targetEntity=Cart::class, mappedBy="product")
  52.      */
  53.     private $carts;
  54.     /**
  55.      * @ORM\OneToMany(targetEntity=Addon::class, mappedBy="product")
  56.      */
  57.     private $addons;
  58.     /**
  59.      * @ORM\OneToMany(targetEntity=SubscriptionPlanPrice::class, mappedBy="product")
  60.      */
  61.     private $subscriptionPlanPrices;
  62.     /**
  63.      * @ORM\ManyToMany(targetEntity=SubscriptionPlan::class, inversedBy="products")
  64.      */
  65.     private $subscription_plan;
  66.     /**
  67.      * @ORM\OneToMany(targetEntity=Subscription::class, mappedBy="product")
  68.      */
  69.     private $subscriptions;
  70.     /**
  71.      * @ORM\OneToMany(targetEntity=ServiceState::class, mappedBy="product")
  72.      */
  73.     private $serviceStates;
  74.     public function __construct()
  75.     {
  76.         $this->carts = new ArrayCollection();
  77.         $this->addons = new ArrayCollection();
  78.         $this->subscription_plan = new ArrayCollection();
  79.         $this->subscriptions = new ArrayCollection();
  80.         $this->serviceStates = new ArrayCollection();
  81.     }
  82.     public function getId(): ?int
  83.     {
  84.         return $this->id;
  85.     }
  86.     public function getProductName(): ?string
  87.     {
  88.         return $this->product_name;
  89.     }
  90.     public function setProductName(string $product_name): self
  91.     {
  92.         $this->product_name $product_name;
  93.         return $this;
  94.     }
  95.     public function getProductDescriptionShort(): ?string
  96.     {
  97.         return $this->product_description_short;
  98.     }
  99.     public function setProductDescriptionShort(string $product_description_short): self
  100.     {
  101.         $this->product_description_short $product_description_short;
  102.         return $this;
  103.     }
  104.     public function getProductDescriptionLong(): ?string
  105.     {
  106.         return $this->product_description_long;
  107.     }
  108.     public function setProductDescriptionLong(?string $product_description_long): self
  109.     {
  110.         $this->product_description_long $product_description_long;
  111.         return $this;
  112.     }
  113.     public function getProductImage(): ?string
  114.     {
  115.         return $this->product_image;
  116.     }
  117.     public function setProductImage(?string $product_image): self
  118.     {
  119.         $this->product_image $product_image;
  120.         return $this;
  121.     }
  122.     public function isIsPublic(): ?bool
  123.     {
  124.         return $this->is_public;
  125.     }
  126.     public function setIsPublic(bool $is_public): self
  127.     {
  128.         $this->is_public $is_public;
  129.         return $this;
  130.     }
  131.     public function isIsActive(): ?bool
  132.     {
  133.         return $this->is_active;
  134.     }
  135.     public function setIsActive(bool $is_active): self
  136.     {
  137.         $this->is_active $is_active;
  138.         return $this;
  139.     }
  140.     public function getRegBy(): ?int
  141.     {
  142.         return $this->reg_by;
  143.     }
  144.     public function setRegBy(?int $reg_by): self
  145.     {
  146.         $this->reg_by $reg_by;
  147.         return $this;
  148.     }
  149.     public function getRegDatetime(): ?\DateTimeInterface
  150.     {
  151.         return $this->reg_datetime;
  152.     }
  153.     public function setRegDatetime(?\DateTimeInterface $reg_datetime): self
  154.     {
  155.         $this->reg_datetime $reg_datetime;
  156.         return $this;
  157.     }
  158.     /**
  159.      * @return Collection<int, Cart>
  160.      */
  161.     public function getCarts(): Collection
  162.     {
  163.         return $this->carts;
  164.     }
  165.     public function addCart(Cart $cart): self
  166.     {
  167.         if (!$this->carts->contains($cart)) {
  168.             $this->carts[] = $cart;
  169.             $cart->setProduct($this);
  170.         }
  171.         return $this;
  172.     }
  173.     public function removeCart(Cart $cart): self
  174.     {
  175.         if ($this->carts->removeElement($cart)) {
  176.             // set the owning side to null (unless already changed)
  177.             if ($cart->getProduct() === $this) {
  178.                 $cart->setProduct(null);
  179.             }
  180.         }
  181.         return $this;
  182.     }
  183.     /**
  184.      * @return Collection<int, Addon>
  185.      */
  186.     public function getAddons(): Collection
  187.     {
  188.         return $this->addons;
  189.     }
  190.     public function addAddon(Addon $addon): self
  191.     {
  192.         if (!$this->addons->contains($addon)) {
  193.             $this->addons[] = $addon;
  194.             $addon->setProduct($this);
  195.         }
  196.         return $this;
  197.     }
  198.     public function removeAddon(Addon $addon): self
  199.     {
  200.         if ($this->addons->removeElement($addon)) {
  201.             // set the owning side to null (unless already changed)
  202.             if ($addon->getProduct() === $this) {
  203.                 $addon->setProduct(null);
  204.             }
  205.         }
  206.         return $this;
  207.     }
  208.     /**
  209.      * @return Collection<int, SubscriptionPlanPrice>
  210.      */
  211.     public function getSubscriptionPlanPrices(): Collection
  212.     {
  213.         return $this->subscriptionPlanPrices;
  214.     }
  215.     public function addSubscriptionPlanPrice(SubscriptionPlanPrice $subscriptionPlanPrice): self
  216.     {
  217.         if (!$this->subscriptionPlanPrices->contains($subscriptionPlanPrice)) {
  218.             $this->subscriptionPlanPrices[] = $subscriptionPlanPrice;
  219.             $subscriptionPlanPrice->setProduct($this);
  220.         }
  221.         return $this;
  222.     }
  223.     public function removeSubscriptionPlanPrice(SubscriptionPlanPrice $subscriptionPlanPrice): self
  224.     {
  225.         if ($this->subscriptionPlanPrices->removeElement($subscriptionPlanPrice)) {
  226.             // set the owning side to null (unless already changed)
  227.             if ($subscriptionPlanPrice->getProduct() === $this) {
  228.                 $subscriptionPlanPrice->setProduct(null);
  229.             }
  230.         }
  231.         return $this;
  232.     }
  233.     /**
  234.      * @return Collection<int, SubscriptionPlan>
  235.      */
  236.     public function getSubscriptionPlan(): Collection
  237.     {
  238.         return $this->subscription_plan;
  239.     }
  240.     public function addSubscriptionPlan(SubscriptionPlan $subscriptionPlan): self
  241.     {
  242.         if (!$this->subscription_plan->contains($subscriptionPlan)) {
  243.             $this->subscription_plan[] = $subscriptionPlan;
  244.         }
  245.         return $this;
  246.     }
  247.     public function removeSubscriptionPlan(SubscriptionPlan $subscriptionPlan): self
  248.     {
  249.         $this->subscription_plan->removeElement($subscriptionPlan);
  250.         return $this;
  251.     }
  252.     public function __toString()
  253.     {
  254.         return $this->getProductName();
  255.     }
  256.     /**
  257.      * @return Collection<int, Subscription>
  258.      */
  259.     public function getSubscriptions(): Collection
  260.     {
  261.         return $this->subscriptions;
  262.     }
  263.     public function addSubscription(Subscription $subscription): self
  264.     {
  265.         if (!$this->subscriptions->contains($subscription)) {
  266.             $this->subscriptions[] = $subscription;
  267.             $subscription->setProduct($this);
  268.         }
  269.         return $this;
  270.     }
  271.     public function removeSubscription(Subscription $subscription): self
  272.     {
  273.         if ($this->subscriptions->removeElement($subscription)) {
  274.             // set the owning side to null (unless already changed)
  275.             if ($subscription->getProduct() === $this) {
  276.                 $subscription->setProduct(null);
  277.             }
  278.         }
  279.         return $this;
  280.     }
  281.     /**
  282.      * @return Collection<int, ServiceState>
  283.      */
  284.     public function getServiceStates(): Collection
  285.     {
  286.         return $this->serviceStates;
  287.     }
  288.     public function addServiceState(ServiceState $serviceState): self
  289.     {
  290.         if (!$this->serviceStates->contains($serviceState)) {
  291.             $this->serviceStates[] = $serviceState;
  292.             $serviceState->setProduct($this);
  293.         }
  294.         return $this;
  295.     }
  296.     public function removeServiceState(ServiceState $serviceState): self
  297.     {
  298.         if ($this->serviceStates->removeElement($serviceState)) {
  299.             // set the owning side to null (unless already changed)
  300.             if ($serviceState->getProduct() === $this) {
  301.                 $serviceState->setProduct(null);
  302.             }
  303.         }
  304.         return $this;
  305.     }
  306. }