src/Entity/Subscription.php line 14

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SubscriptionRepository;
  4. use App\Traits\TimeStampTrait;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassSubscriptionRepository::class)]
  10. #[ORM\HasLifecycleCallbacks]
  11. class Subscription
  12. {
  13.     use TimeStampTrait;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\ManyToOne(inversedBy'subscriptions')]
  19.     private ?Entreprise $entreprise null;
  20.     #[ORM\ManyToOne(inversedBy'entreprisePackages')]
  21.     private ?Package $package null;
  22.     #[ORM\Column]
  23.     private ?bool $status null;
  24.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  25.     private ?\DateTimeInterface $startAt null;
  26.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  27.     private ?\DateTimeInterface $endAt null;
  28.     #[ORM\Column(length50)]
  29.     private ?string $paymenttype null;
  30.     #[ORM\Column(typeTypes::DECIMALprecision10scale2)]
  31.     private ?string $amount null;
  32.     #[ORM\Column(length10)]
  33.     private ?string $currency null;
  34.     #[ORM\Column]
  35.     private ?bool $paid null;
  36.     #[ORM\Column(length255)]
  37.     private ?string $orderNumber null;
  38.     #[ORM\Column(length100nullabletrue)]
  39.     private ?string $code null;
  40.     #[ORM\OneToMany(mappedBy'subscription'targetEntitySubscriptionPayment::class)]
  41.     private Collection $subscriptionPayments;
  42.     public function __construct()
  43.     {
  44.         $this->subscriptionPayments = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getEntreprise(): ?Entreprise
  51.     {
  52.         return $this->entreprise;
  53.     }
  54.     public function setEntreprise(?Entreprise $entreprise): static
  55.     {
  56.         $this->entreprise $entreprise;
  57.         return $this;
  58.     }
  59.     public function getPackage(): ?Package
  60.     {
  61.         return $this->package;
  62.     }
  63.     public function setPackage(?Package $package): static
  64.     {
  65.         $this->package $package;
  66.         return $this;
  67.     }
  68.     public function isStatus(): ?bool
  69.     {
  70.         return $this->status;
  71.     }
  72.     public function setStatus(bool $status): static
  73.     {
  74.         $this->status $status;
  75.         return $this;
  76.     }
  77.     public function getStartAt(): ?\DateTimeInterface
  78.     {
  79.         return $this->startAt;
  80.     }
  81.     public function setStartAt(\DateTimeInterface $startAt): static
  82.     {
  83.         $this->startAt $startAt;
  84.         return $this;
  85.     }
  86.     public function getEndAt(): ?\DateTimeInterface
  87.     {
  88.         return $this->endAt;
  89.     }
  90.     public function setEndAt(\DateTimeInterface $endAt): static
  91.     {
  92.         $this->endAt $endAt;
  93.         return $this;
  94.     }
  95.     public function getPaymenttype(): ?string
  96.     {
  97.         return $this->paymenttype;
  98.     }
  99.     public function setPaymenttype(string $paymenttype): static
  100.     {
  101.         $this->paymenttype $paymenttype;
  102.         return $this;
  103.     }
  104.     public function getAmount(): ?string
  105.     {
  106.         return $this->amount;
  107.     }
  108.     public function setAmount(string $amount): static
  109.     {
  110.         $this->amount $amount;
  111.         return $this;
  112.     }
  113.     public function getCurrency(): ?string
  114.     {
  115.         return $this->currency;
  116.     }
  117.     public function setCurrency(string $currency): static
  118.     {
  119.         $this->currency $currency;
  120.         return $this;
  121.     }
  122.     public function isPaid(): ?bool
  123.     {
  124.         return $this->paid;
  125.     }
  126.     public function setPaid(bool $paid): static
  127.     {
  128.         $this->paid $paid;
  129.         return $this;
  130.     }
  131.     public function getOrderNumber(): ?string
  132.     {
  133.         return $this->orderNumber;
  134.     }
  135.     public function setOrderNumber(string $orderNumber): static
  136.     {
  137.         $this->orderNumber $orderNumber;
  138.         return $this;
  139.     }
  140.     public function getCode(): ?string
  141.     {
  142.         return $this->code;
  143.     }
  144.     public function setCode(?string $code): static
  145.     {
  146.         $this->code $code;
  147.         return $this;
  148.     }
  149.     /**
  150.      * @return Collection<int, SubscriptionPayment>
  151.      */
  152.     public function getSubscriptionPayments(): Collection
  153.     {
  154.         return $this->subscriptionPayments;
  155.     }
  156.     public function addSubscriptionPayment(SubscriptionPayment $subscriptionPayment): static
  157.     {
  158.         if (!$this->subscriptionPayments->contains($subscriptionPayment)) {
  159.             $this->subscriptionPayments->add($subscriptionPayment);
  160.             $subscriptionPayment->setSubscription($this);
  161.         }
  162.         return $this;
  163.     }
  164.     public function removeSubscriptionPayment(SubscriptionPayment $subscriptionPayment): static
  165.     {
  166.         if ($this->subscriptionPayments->removeElement($subscriptionPayment)) {
  167.             if ($subscriptionPayment->getSubscription() === $this) {
  168.                 $subscriptionPayment->setSubscription(null);
  169.             }
  170.         }
  171.         return $this;
  172.     }
  173. }