src/Entity/Subscription.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SubscriptionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Entity(repositoryClass=SubscriptionRepository::class)
  10.  */
  11. class Subscription
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=100)
  21.      */
  22.     private $title;
  23.     /**
  24.      * @ORM\Column(type="text")
  25.      */
  26.     private $description;
  27.     /**
  28.      * @Gedmo\Slug(fields={"title"})
  29.      * @ORM\Column(length=128, unique=true)
  30.      */
  31.     private $slug;
  32.     /**
  33.      * @ORM\Column(type="integer", nullable=true)
  34.      */
  35.     private $delay;
  36.     /**
  37.      * @ORM\Column(type="integer")
  38.      */
  39.     private $price;
  40.     /**
  41.      * @ORM\OneToMany(targetEntity=Payment::class, mappedBy="subscription")
  42.      */
  43.     private $payments;
  44.     /**
  45.      * @ORM\OneToMany(targetEntity=PayPage::class, mappedBy="subscription")
  46.      */
  47.     private $payPages;
  48.     public function __construct()
  49.     {
  50.         $this->payments = new ArrayCollection();
  51.         $this->payPages = new ArrayCollection();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getTitle(): ?string
  58.     {
  59.         return $this->title;
  60.     }
  61.     public function setTitle(string $title): self
  62.     {
  63.         $this->title $title;
  64.         return $this;
  65.     }
  66.     public function getDescription(): ?string
  67.     {
  68.         return $this->description;
  69.     }
  70.     public function setDescription(string $description): self
  71.     {
  72.         $this->description $description;
  73.         return $this;
  74.     }
  75.     public function getDelay(): ?int
  76.     {
  77.         return $this->delay;
  78.     }
  79.     public function setDelay(?int $delay): self
  80.     {
  81.         $this->delay $delay;
  82.         return $this;
  83.     }
  84.     public function getPrice(): ?int
  85.     {
  86.         return $this->price;
  87.     }
  88.     public function setPrice(int $price): self
  89.     {
  90.         $this->price $price;
  91.         return $this;
  92.     }
  93.     /**
  94.      * @return Collection<int, Payment>
  95.      */
  96.     public function getPayments(): Collection
  97.     {
  98.         return $this->payments;
  99.     }
  100.     public function addPayment(Payment $payment): self
  101.     {
  102.         if (!$this->payments->contains($payment)) {
  103.             $this->payments[] = $payment;
  104.             $payment->setSubscription($this);
  105.         }
  106.         return $this;
  107.     }
  108.     public function removePayment(Payment $payment): self
  109.     {
  110.         if ($this->payments->removeElement($payment)) {
  111.             // set the owning side to null (unless already changed)
  112.             if ($payment->getSubscription() === $this) {
  113.                 $payment->setSubscription(null);
  114.             }
  115.         }
  116.         return $this;
  117.     }
  118.     /**
  119.      * @return mixed
  120.      */
  121.     public function getSlug()
  122.     {
  123.         return $this->slug;
  124.     }
  125.     /**
  126.      * @param mixed $slug
  127.      */
  128.     public function setSlug($slug): void
  129.     {
  130.         $this->slug $slug;
  131.     }
  132.     /**
  133.      * @return Collection<int, PayPage>
  134.      */
  135.     public function getPayPages(): Collection
  136.     {
  137.         return $this->payPages;
  138.     }
  139.     public function addPayPage(PayPage $payPage): self
  140.     {
  141.         if (!$this->payPages->contains($payPage)) {
  142.             $this->payPages[] = $payPage;
  143.             $payPage->setSubscription($this);
  144.         }
  145.         return $this;
  146.     }
  147.     public function removePayPage(PayPage $payPage): self
  148.     {
  149.         if ($this->payPages->removeElement($payPage)) {
  150.             // set the owning side to null (unless already changed)
  151.             if ($payPage->getSubscription() === $this) {
  152.                 $payPage->setSubscription(null);
  153.             }
  154.         }
  155.         return $this;
  156.     }
  157. }