src/Entity/Subscription.php line 11

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. #[ORM\Entity(repositoryClassSubscriptionRepository::class)]
  8. class Subscription
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\ManyToOne(targetEntityOffer::class, inversedBy'subscriptions')]
  15.     private $offer;
  16.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'subscriptions')]
  17.     private $pro;
  18.     #[ORM\Column(type'date')]
  19.     private $start;
  20.     #[ORM\Column(type'date')]
  21.     private $end;
  22.     #[ORM\Column(type'string'length255)]
  23.     private $status;
  24.     #[ORM\Column(type'string'length255)]
  25.     private $stripeSubscriptionId;
  26.     #[ORM\Column(type'boolean'nullabletrue)]
  27.     private $trial;
  28.     #[ORM\Column(type'date'nullabletrue)]
  29.     private $trialEnd;
  30.     #[ORM\Column(type'datetime'nullabletrue)]
  31.     private $endedAt;
  32.     #[ORM\Column(type'boolean')]
  33.     private $isFirstTime;
  34.     #[ORM\ManyToOne(targetEntityDiscountCode::class, inversedBy'subscriptions')]
  35.     private $discount;
  36.     #[ORM\Column(type'date'nullabletrue)]
  37.     private $discountEnd;
  38.     #[ORM\Column(type'date'nullabletrue)]
  39.     private $createdAt;
  40.     #[ORM\OneToMany(mappedBy'subscription'targetEntityInvoice::class)]
  41.     private Collection $invoices;
  42.     public function __construct()
  43.     {
  44.         $this->invoices = new ArrayCollection();
  45.     }
  46.     public function __clone() {
  47.         $this->id null;
  48.     }
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getOffer(): ?Offer
  54.     {
  55.         return $this->offer;
  56.     }
  57.     public function setOffer(?Offer $offer): self
  58.     {
  59.         $this->offer $offer;
  60.         return $this;
  61.     }
  62.     public function getPro(): ?User
  63.     {
  64.         return $this->pro;
  65.     }
  66.     public function setPro(?User $pro): self
  67.     {
  68.         $this->pro $pro;
  69.         return $this;
  70.     }
  71.     public function getStart(): ?\DateTimeInterface
  72.     {
  73.         return $this->start;
  74.     }
  75.     public function setStart(\DateTimeInterface $start): self
  76.     {
  77.         $this->start $start;
  78.         return $this;
  79.     }
  80.     public function getEnd(): ?\DateTimeInterface
  81.     {
  82.         return $this->end;
  83.     }
  84.     public function setEnd(\DateTimeInterface $end): self
  85.     {
  86.         $this->end $end;
  87.         return $this;
  88.     }
  89.     public function getStatus(): ?string
  90.     {
  91.         return $this->status;
  92.     }
  93.     public function setStatus(string $status): self
  94.     {
  95.         $this->status $status;
  96.         return $this;
  97.     }
  98.     public function getStripeSubscriptionId(): ?string
  99.     {
  100.         return $this->stripeSubscriptionId;
  101.     }
  102.     public function setStripeSubscriptionId(string $stripeSubscriptionId): self
  103.     {
  104.         $this->stripeSubscriptionId $stripeSubscriptionId;
  105.         return $this;
  106.     }
  107.     public function getTrial(): ?bool
  108.     {
  109.         return $this->trial;
  110.     }
  111.     public function setTrial(?bool $trial): self
  112.     {
  113.         $this->trial $trial;
  114.         return $this;
  115.     }
  116.     public function getTrialEnd(): ?\DateTimeInterface
  117.     {
  118.         return $this->trialEnd;
  119.     }
  120.     public function setTrialEnd(?\DateTimeInterface $trialEnd): self
  121.     {
  122.         $this->trialEnd $trialEnd;
  123.         return $this;
  124.     }
  125.     public function getEndedAt(): ?\DateTimeInterface
  126.     {
  127.         return $this->endedAt;
  128.     }
  129.     public function setEndedAt(?\DateTimeInterface $endedAt): self
  130.     {
  131.         $this->endedAt $endedAt;
  132.         return $this;
  133.     }
  134.     public function getIsFirstTime(): ?bool
  135.     {
  136.         return $this->isFirstTime;
  137.     }
  138.     public function setIsFirstTime(bool $isFirstTime): self
  139.     {
  140.         $this->isFirstTime $isFirstTime;
  141.         return $this;
  142.     }
  143.     public function getDiscount(): ?DiscountCode
  144.     {
  145.         return $this->discount;
  146.     }
  147.     public function setDiscount(?DiscountCode $discount): self
  148.     {
  149.         $this->discount $discount;
  150.         return $this;
  151.     }
  152.     public function getDiscountEnd(): ?\DateTimeInterface
  153.     {
  154.         return $this->discountEnd;
  155.     }
  156.     public function setDiscountEnd(?\DateTimeInterface $discountEnd): self
  157.     {
  158.         $this->discountEnd $discountEnd;
  159.         return $this;
  160.     }
  161.     public function getCreatedAt(): ?\DateTimeInterface
  162.     {
  163.         return $this->createdAt;
  164.     }
  165.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  166.     {
  167.         $this->createdAt $createdAt;
  168.         return $this;
  169.     }
  170.     /**
  171.      * @return Collection<int, Invoice>
  172.      */
  173.     public function getInvoices(): Collection
  174.     {
  175.         return $this->invoices;
  176.     }
  177.     public function addInvoice(Invoice $invoice): static
  178.     {
  179.         if (!$this->invoices->contains($invoice)) {
  180.             $this->invoices->add($invoice);
  181.             $invoice->setSubscription($this);
  182.         }
  183.         return $this;
  184.     }
  185.     public function removeInvoice(Invoice $invoice): static
  186.     {
  187.         if ($this->invoices->removeElement($invoice)) {
  188.             // set the owning side to null (unless already changed)
  189.             if ($invoice->getSubscription() === $this) {
  190.                 $invoice->setSubscription(null);
  191.             }
  192.         }
  193.         return $this;
  194.     }
  195. }