<?php
namespace App\Entity;
use App\Repository\AddonRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=AddonRepository::class)
*/
class Addon
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Product::class, inversedBy="addons")
*/
private $product;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $addon_description_short;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $addon_description_long;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $product_image;
/**
* @ORM\Column(type="boolean")
*/
private $is_public;
/**
* @ORM\Column(type="boolean")
*/
private $is_active;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $reg_by;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $reg_datetime;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $mod_name;
/**
* @ORM\Column(type="string", length=255)
*/
private $addon_name;
/**
* @ORM\OneToMany(targetEntity=Cart::class, mappedBy="addon")
*/
private $carts;
/**
* @ORM\OneToMany(targetEntity=Subscription::class, mappedBy="addon")
*/
private $subscriptions;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
*/
private $single_price_month_user;
public function __construct()
{
$this->carts = new ArrayCollection();
$this->subscriptions = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getProduct(): ?Product
{
return $this->product;
}
public function setProduct(?Product $product): self
{
$this->product = $product;
return $this;
}
public function getAddonDescriptionShort(): ?string
{
return $this->addon_description_short;
}
public function setAddonDescriptionShort(?string $addon_description_short): self
{
$this->addon_description_short = $addon_description_short;
return $this;
}
public function getAddonDescriptionLong(): ?string
{
return $this->addon_description_long;
}
public function setAddonDescriptionLong(?string $addon_description_long): self
{
$this->addon_description_long = $addon_description_long;
return $this;
}
public function getProductImage(): ?string
{
return $this->product_image;
}
public function setProductImage(?string $product_image): self
{
$this->product_image = $product_image;
return $this;
}
public function isIsPublic(): ?bool
{
return $this->is_public;
}
public function setIsPublic(bool $is_public): self
{
$this->is_public = $is_public;
return $this;
}
public function isIsActive(): ?bool
{
return $this->is_active;
}
public function setIsActive(bool $is_active): self
{
$this->is_active = $is_active;
return $this;
}
public function getRegBy(): ?int
{
return $this->reg_by;
}
public function setRegBy(?int $reg_by): self
{
$this->reg_by = $reg_by;
return $this;
}
public function getRegDatetime(): ?\DateTimeInterface
{
return $this->reg_datetime;
}
public function setRegDatetime(?\DateTimeInterface $reg_datetime): self
{
$this->reg_datetime = $reg_datetime;
return $this;
}
public function getModName(): ?string
{
return $this->mod_name;
}
public function setModName(?string $mod_name): self
{
$this->mod_name = $mod_name;
return $this;
}
public function getAddonName(): ?string
{
return $this->addon_name;
}
public function setAddonName(string $addon_name): self
{
$this->addon_name = $addon_name;
return $this;
}
public function __toString()
{
return $this->getAddonName();
}
/**
* @return Collection<int, Cart>
*/
public function getCarts(): Collection
{
return $this->carts;
}
public function addCart(Cart $cart): self
{
if (!$this->carts->contains($cart)) {
$this->carts[] = $cart;
$cart->setAddon($this);
}
return $this;
}
public function removeCart(Cart $cart): self
{
if ($this->carts->removeElement($cart)) {
// set the owning side to null (unless already changed)
if ($cart->getAddon() === $this) {
$cart->setAddon(null);
}
}
return $this;
}
/**
* @return Collection<int, Subscription>
*/
public function getSubscriptions(): Collection
{
return $this->subscriptions;
}
public function addSubscription(Subscription $subscription): self
{
if (!$this->subscriptions->contains($subscription)) {
$this->subscriptions[] = $subscription;
$subscription->setAddon($this);
}
return $this;
}
public function removeSubscription(Subscription $subscription): self
{
if ($this->subscriptions->removeElement($subscription)) {
// set the owning side to null (unless already changed)
if ($subscription->getAddon() === $this) {
$subscription->setAddon(null);
}
}
return $this;
}
public function getSinglePriceMonthUser(): ?string
{
return $this->single_price_month_user;
}
public function setSinglePriceMonthUser(string $single_price_month_user): self
{
$this->single_price_month_user = $single_price_month_user;
return $this;
}
}