<?php
namespace App\Entity;
use App\Repository\SubscriptionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=SubscriptionRepository::class)
*/
class Subscription
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $title;
/**
* @ORM\Column(type="text")
*/
private $description;
/**
* @Gedmo\Slug(fields={"title"})
* @ORM\Column(length=128, unique=true)
*/
private $slug;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $delay;
/**
* @ORM\Column(type="integer")
*/
private $price;
/**
* @ORM\OneToMany(targetEntity=Payment::class, mappedBy="subscription")
*/
private $payments;
/**
* @ORM\OneToMany(targetEntity=PayPage::class, mappedBy="subscription")
*/
private $payPages;
public function __construct()
{
$this->payments = new ArrayCollection();
$this->payPages = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getDelay(): ?int
{
return $this->delay;
}
public function setDelay(?int $delay): self
{
$this->delay = $delay;
return $this;
}
public function getPrice(): ?int
{
return $this->price;
}
public function setPrice(int $price): self
{
$this->price = $price;
return $this;
}
/**
* @return Collection<int, Payment>
*/
public function getPayments(): Collection
{
return $this->payments;
}
public function addPayment(Payment $payment): self
{
if (!$this->payments->contains($payment)) {
$this->payments[] = $payment;
$payment->setSubscription($this);
}
return $this;
}
public function removePayment(Payment $payment): self
{
if ($this->payments->removeElement($payment)) {
// set the owning side to null (unless already changed)
if ($payment->getSubscription() === $this) {
$payment->setSubscription(null);
}
}
return $this;
}
/**
* @return mixed
*/
public function getSlug()
{
return $this->slug;
}
/**
* @param mixed $slug
*/
public function setSlug($slug): void
{
$this->slug = $slug;
}
/**
* @return Collection<int, PayPage>
*/
public function getPayPages(): Collection
{
return $this->payPages;
}
public function addPayPage(PayPage $payPage): self
{
if (!$this->payPages->contains($payPage)) {
$this->payPages[] = $payPage;
$payPage->setSubscription($this);
}
return $this;
}
public function removePayPage(PayPage $payPage): self
{
if ($this->payPages->removeElement($payPage)) {
// set the owning side to null (unless already changed)
if ($payPage->getSubscription() === $this) {
$payPage->setSubscription(null);
}
}
return $this;
}
}