src/Entity/Addon.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AddonRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=AddonRepository::class)
  9.  */
  10. class Addon
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=Product::class, inversedBy="addons")
  20.      */
  21.     private $product;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private $addon_description_short;
  26.     /**
  27.      * @ORM\Column(type="text", nullable=true)
  28.      */
  29.     private $addon_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\Column(type="string", length=255, nullable=true)
  52.      */
  53.     private $mod_name;
  54.     /**
  55.      * @ORM\Column(type="string", length=255)
  56.      */
  57.     private $addon_name;
  58.     /**
  59.      * @ORM\OneToMany(targetEntity=Cart::class, mappedBy="addon")
  60.      */
  61.     private $carts;
  62.     /**
  63.      * @ORM\OneToMany(targetEntity=Subscription::class, mappedBy="addon")
  64.      */
  65.     private $subscriptions;
  66.     /**
  67.      * @ORM\Column(type="decimal", precision=10, scale=2)
  68.      */
  69.     private $single_price_month_user;
  70.     public function __construct()
  71.     {
  72.         $this->carts = new ArrayCollection();
  73.         $this->subscriptions = new ArrayCollection();
  74.     }
  75.     public function getId(): ?int
  76.     {
  77.         return $this->id;
  78.     }
  79.     public function getProduct(): ?Product
  80.     {
  81.         return $this->product;
  82.     }
  83.     public function setProduct(?Product $product): self
  84.     {
  85.         $this->product $product;
  86.         return $this;
  87.     }
  88.     public function getAddonDescriptionShort(): ?string
  89.     {
  90.         return $this->addon_description_short;
  91.     }
  92.     public function setAddonDescriptionShort(?string $addon_description_short): self
  93.     {
  94.         $this->addon_description_short $addon_description_short;
  95.         return $this;
  96.     }
  97.     public function getAddonDescriptionLong(): ?string
  98.     {
  99.         return $this->addon_description_long;
  100.     }
  101.     public function setAddonDescriptionLong(?string $addon_description_long): self
  102.     {
  103.         $this->addon_description_long $addon_description_long;
  104.         return $this;
  105.     }
  106.     public function getProductImage(): ?string
  107.     {
  108.         return $this->product_image;
  109.     }
  110.     public function setProductImage(?string $product_image): self
  111.     {
  112.         $this->product_image $product_image;
  113.         return $this;
  114.     }
  115.     public function isIsPublic(): ?bool
  116.     {
  117.         return $this->is_public;
  118.     }
  119.     public function setIsPublic(bool $is_public): self
  120.     {
  121.         $this->is_public $is_public;
  122.         return $this;
  123.     }
  124.     public function isIsActive(): ?bool
  125.     {
  126.         return $this->is_active;
  127.     }
  128.     public function setIsActive(bool $is_active): self
  129.     {
  130.         $this->is_active $is_active;
  131.         return $this;
  132.     }
  133.     public function getRegBy(): ?int
  134.     {
  135.         return $this->reg_by;
  136.     }
  137.     public function setRegBy(?int $reg_by): self
  138.     {
  139.         $this->reg_by $reg_by;
  140.         return $this;
  141.     }
  142.     public function getRegDatetime(): ?\DateTimeInterface
  143.     {
  144.         return $this->reg_datetime;
  145.     }
  146.     public function setRegDatetime(?\DateTimeInterface $reg_datetime): self
  147.     {
  148.         $this->reg_datetime $reg_datetime;
  149.         return $this;
  150.     }
  151.     public function getModName(): ?string
  152.     {
  153.         return $this->mod_name;
  154.     }
  155.     public function setModName(?string $mod_name): self
  156.     {
  157.         $this->mod_name $mod_name;
  158.         return $this;
  159.     }
  160.     public function getAddonName(): ?string
  161.     {
  162.         return $this->addon_name;
  163.     }
  164.     public function setAddonName(string $addon_name): self
  165.     {
  166.         $this->addon_name $addon_name;
  167.         return $this;
  168.     }
  169.     public function __toString()
  170.     {
  171.         return $this->getAddonName();
  172.     }
  173.     /**
  174.      * @return Collection<int, Cart>
  175.      */
  176.     public function getCarts(): Collection
  177.     {
  178.         return $this->carts;
  179.     }
  180.     public function addCart(Cart $cart): self
  181.     {
  182.         if (!$this->carts->contains($cart)) {
  183.             $this->carts[] = $cart;
  184.             $cart->setAddon($this);
  185.         }
  186.         return $this;
  187.     }
  188.     public function removeCart(Cart $cart): self
  189.     {
  190.         if ($this->carts->removeElement($cart)) {
  191.             // set the owning side to null (unless already changed)
  192.             if ($cart->getAddon() === $this) {
  193.                 $cart->setAddon(null);
  194.             }
  195.         }
  196.         return $this;
  197.     }
  198.     /**
  199.      * @return Collection<int, Subscription>
  200.      */
  201.     public function getSubscriptions(): Collection
  202.     {
  203.         return $this->subscriptions;
  204.     }
  205.     public function addSubscription(Subscription $subscription): self
  206.     {
  207.         if (!$this->subscriptions->contains($subscription)) {
  208.             $this->subscriptions[] = $subscription;
  209.             $subscription->setAddon($this);
  210.         }
  211.         return $this;
  212.     }
  213.     public function removeSubscription(Subscription $subscription): self
  214.     {
  215.         if ($this->subscriptions->removeElement($subscription)) {
  216.             // set the owning side to null (unless already changed)
  217.             if ($subscription->getAddon() === $this) {
  218.                 $subscription->setAddon(null);
  219.             }
  220.         }
  221.         return $this;
  222.     }
  223.     public function getSinglePriceMonthUser(): ?string
  224.     {
  225.         return $this->single_price_month_user;
  226.     }
  227.     public function setSinglePriceMonthUser(string $single_price_month_user): self
  228.     {
  229.         $this->single_price_month_user $single_price_month_user;
  230.         return $this;
  231.     }
  232. }