<?php
namespace App\Entity;
use App\Repository\SubscriptionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SubscriptionRepository::class)
*/
class Subscription
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $server_address;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $server_ip;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="subscriptions")
*/
private $client;
/**
* @ORM\Column(type="integer")
*/
private $amount_users;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
*/
private $product_price;
/**
* @ORM\ManyToOne(targetEntity=PaymentTerm::class, inversedBy="subscriptions")
*/
private $payment_term;
/**
* @ORM\ManyToOne(targetEntity=Payment::class, inversedBy="subscriptions")
*/
private $payment;
/**
* @ORM\Column(type="boolean")
*/
private $is_auto_renew;
/**
* @ORM\Column(type="boolean")
*/
private $is_active;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $reg_datetime;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $activation_date;
/**
* @ORM\ManyToOne(targetEntity=Addon::class, inversedBy="subscriptions")
*/
private $addon;
/**
* @ORM\ManyToOne(targetEntity=Product::class, inversedBy="subscriptions")
*/
private $product;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $billing_date;
/**
* @ORM\OneToMany(targetEntity=Invoice::class, mappedBy="subscription")
*/
private $invoices;
/**
* @ORM\ManyToOne(targetEntity=ProductWebhosting::class, inversedBy="subscriptions")
*/
private $product_webhosting;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $domain;
public function __construct()
{
$this->invoices = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getServerAddress(): ?string
{
return $this->server_address;
}
public function setServerAddress(string $server_address): self
{
$this->server_address = $server_address;
return $this;
}
public function getServerIp(): ?string
{
return $this->server_ip;
}
public function setServerIp(?string $server_ip): self
{
$this->server_ip = $server_ip;
return $this;
}
public function getClient(): ?User
{
return $this->client;
}
public function setClient(?User $client): self
{
$this->client = $client;
return $this;
}
public function getAmountUsers(): ?int
{
return $this->amount_users;
}
public function setAmountUsers(int $amount_users): self
{
$this->amount_users = $amount_users;
return $this;
}
public function getProductPrice(): ?string
{
return $this->product_price;
}
public function setProductPrice(string $product_price): self
{
$this->product_price = $product_price;
return $this;
}
public function getPaymentTerm(): ?PaymentTerm
{
return $this->payment_term;
}
public function setPaymentTerm(?PaymentTerm $payment_term): self
{
$this->payment_term = $payment_term;
return $this;
}
public function getPayment(): ?Payment
{
return $this->payment;
}
public function setPayment(?Payment $payment): self
{
$this->payment = $payment;
return $this;
}
public function isIsAutoRenew(): ?bool
{
return $this->is_auto_renew;
}
public function setIsAutoRenew(bool $is_auto_renew): self
{
$this->is_auto_renew = $is_auto_renew;
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 getRegDatetime(): ?\DateTimeInterface
{
return $this->reg_datetime;
}
public function setRegDatetime(?\DateTimeInterface $reg_datetime): self
{
$this->reg_datetime = $reg_datetime;
return $this;
}
public function getActivationDate(): ?\DateTimeInterface
{
return $this->activation_date;
}
public function setActivationDate(?\DateTimeInterface $activation_date): self
{
$this->activation_date = $activation_date;
return $this;
}
public function getAddon(): ?Addon
{
return $this->addon;
}
public function setAddon(?Addon $addon): self
{
$this->addon = $addon;
return $this;
}
public function getProduct(): ?Product
{
return $this->product;
}
public function setProduct(?Product $product): self
{
$this->product = $product;
return $this;
}
public function getBillingDate(): ?\DateTimeInterface
{
return $this->billing_date;
}
public function setBillingDate(?\DateTimeInterface $billing_date): self
{
$this->billing_date = $billing_date;
return $this;
}
/**
* @return Collection<int, Invoice>
*/
public function getInvoices(): Collection
{
return $this->invoices;
}
public function addInvoice(Invoice $invoice): self
{
if (!$this->invoices->contains($invoice)) {
$this->invoices[] = $invoice;
$invoice->setSubscription($this);
}
return $this;
}
public function removeInvoice(Invoice $invoice): self
{
if ($this->invoices->removeElement($invoice)) {
// set the owning side to null (unless already changed)
if ($invoice->getSubscription() === $this) {
$invoice->setSubscription(null);
}
}
return $this;
}
public function getProductWebhosting(): ?ProductWebhosting
{
return $this->product_webhosting;
}
public function setProductWebhosting(?ProductWebhosting $product_webhosting): self
{
$this->product_webhosting = $product_webhosting;
return $this;
}
public function getDomain(): ?string
{
return $this->domain;
}
public function setDomain(?string $domain): self
{
$this->domain = $domain;
return $this;
}
}