src/Entity/Abonnement.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AbonnementRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=AbonnementRepository::class)
  9.  */
  10. class Abonnement
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255, nullable=true)
  20.      */
  21.     private $mangoRecurringRegistrationId;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="abonnement")
  24.      * @ORM\JoinColumn(nullable=false)
  25.      */
  26.     private $company;
  27.     /**
  28.      * @ORM\Column(type="datetime_immutable", options={"default"="CURRENT_TIMESTAMP"})
  29.      */
  30.     private $created_at;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=TypeAbonnement::class, inversedBy="abonnements", fetch="EAGER")
  33.      */
  34.     private $typeAbonnement;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=Paiement::class, mappedBy="abonnement", cascade={"persist","remove"})
  37.      */
  38.     private $paiements;
  39.     /**
  40.      * @ORM\Column(type="datetime_immutable", options={"default"="CURRENT_TIMESTAMP"})
  41.      */
  42.     private $nextUpdate;
  43.     /**
  44.      * @ORM\Column(type="boolean")
  45.      */
  46.     private $isActive;
  47.     /**
  48.      * @ORM\Column(type="text", nullable=true)
  49.      */
  50.     private $disablingReason;
  51.     /**
  52.      * @ORM\Column(type="string", length=255, nullable=true)
  53.      */
  54.     private $stripeSubscriptionId;
  55.     public function __construct()
  56.     {
  57.         $this->paiements = new ArrayCollection();
  58.         $this->created_at = new \DateTimeImmutable();
  59.     }
  60.     public function getId(): ?int
  61.     {
  62.         return $this->id;
  63.     }
  64.     public function getMangoRecurringRegistrationId(): ?string
  65.     {
  66.         return $this->mangoRecurringRegistrationId;
  67.     }
  68.     public function setMangoRecurringRegistrationId(?string $mangoRecurringRegistrationId): self
  69.     {
  70.         $this->mangoRecurringRegistrationId $mangoRecurringRegistrationId;
  71.         return $this;
  72.     }
  73.     public function getCompany(): ?Company
  74.     {
  75.         return $this->company;
  76.     }
  77.     public function setCompany(Company $company): self
  78.     {
  79.         $this->company $company;
  80.         return $this;
  81.     }
  82.     public function getCreatedAt(): ?\DateTimeImmutable
  83.     {
  84.         return $this->created_at;
  85.     }
  86.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  87.     {
  88.         $this->created_at $created_at;
  89.         return $this;
  90.     }
  91.     public function getTypeAbonnement(): ?TypeAbonnement
  92.     {
  93.         return $this->typeAbonnement;
  94.     }
  95.     public function setTypeAbonnement(?TypeAbonnement $typeAbonnement): self
  96.     {
  97.         $this->typeAbonnement $typeAbonnement;
  98.         return $this;
  99.     }
  100.     /**
  101.      * @return Collection|Paiement[]
  102.      */
  103.     public function getPaiements(): Collection
  104.     {
  105.         return $this->paiements;
  106.     }
  107.     public function addPaiement(Paiement $paiement): self
  108.     {
  109.         if (!$this->paiements->contains($paiement)) {
  110.             $this->paiements[] = $paiement;
  111.             $paiement->setAbonnement($this);
  112.         }
  113.         return $this;
  114.     }
  115.     public function removePaiement(Paiement $paiement): self
  116.     {
  117.         if ($this->paiements->removeElement($paiement)) {
  118.             // set the owning side to null (unless already changed)
  119.             if ($paiement->getAbonnement() === $this) {
  120.                 $paiement->setAbonnement(null);
  121.             }
  122.         }
  123.         return $this;
  124.     }
  125.     public function getNextUpdate(): ?\DateTimeImmutable
  126.     {
  127.         return $this->nextUpdate;
  128.     }
  129.     public function setNextUpdate(\DateTimeImmutable $nextUpdate): self
  130.     {
  131.         $this->nextUpdate $nextUpdate;
  132.         return $this;
  133.     }
  134.     public function getIsActive(): ?bool
  135.     {
  136.         return $this->isActive;
  137.     }
  138.     public function setIsActive(bool $isActive): self
  139.     {
  140.         $this->isActive $isActive;
  141.         return $this;
  142.     }
  143.     public function getDisablingReason(): ?string
  144.     {
  145.         return $this->disablingReason;
  146.     }
  147.     public function setDisablingReason(?string $disablingReason): self
  148.     {
  149.         $this->disablingReason $disablingReason;
  150.         return $this;
  151.     }
  152.     public function getStripeSubscriptionId(): ?string
  153.     {
  154.         return $this->stripeSubscriptionId;
  155.     }
  156.     public function setStripeSubscriptionId(?string $stripeSubscriptionId): self
  157.     {
  158.         $this->stripeSubscriptionId $stripeSubscriptionId;
  159.         return $this;
  160.     }
  161. }