<?php
namespace App\Entity;
use App\Repository\AbonnementRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=AbonnementRepository::class)
*/
class Abonnement
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $mangoRecurringRegistrationId;
/**
* @ORM\ManyToOne(targetEntity=Company::class, inversedBy="abonnement")
* @ORM\JoinColumn(nullable=false)
*/
private $company;
/**
* @ORM\Column(type="datetime_immutable", options={"default"="CURRENT_TIMESTAMP"})
*/
private $created_at;
/**
* @ORM\ManyToOne(targetEntity=TypeAbonnement::class, inversedBy="abonnements", fetch="EAGER")
*/
private $typeAbonnement;
/**
* @ORM\OneToMany(targetEntity=Paiement::class, mappedBy="abonnement", cascade={"persist","remove"})
*/
private $paiements;
/**
* @ORM\Column(type="datetime_immutable", options={"default"="CURRENT_TIMESTAMP"})
*/
private $nextUpdate;
/**
* @ORM\Column(type="boolean")
*/
private $isActive;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $disablingReason;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $stripeSubscriptionId;
public function __construct()
{
$this->paiements = new ArrayCollection();
$this->created_at = new \DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getMangoRecurringRegistrationId(): ?string
{
return $this->mangoRecurringRegistrationId;
}
public function setMangoRecurringRegistrationId(?string $mangoRecurringRegistrationId): self
{
$this->mangoRecurringRegistrationId = $mangoRecurringRegistrationId;
return $this;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(Company $company): self
{
$this->company = $company;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getTypeAbonnement(): ?TypeAbonnement
{
return $this->typeAbonnement;
}
public function setTypeAbonnement(?TypeAbonnement $typeAbonnement): self
{
$this->typeAbonnement = $typeAbonnement;
return $this;
}
/**
* @return Collection|Paiement[]
*/
public function getPaiements(): Collection
{
return $this->paiements;
}
public function addPaiement(Paiement $paiement): self
{
if (!$this->paiements->contains($paiement)) {
$this->paiements[] = $paiement;
$paiement->setAbonnement($this);
}
return $this;
}
public function removePaiement(Paiement $paiement): self
{
if ($this->paiements->removeElement($paiement)) {
// set the owning side to null (unless already changed)
if ($paiement->getAbonnement() === $this) {
$paiement->setAbonnement(null);
}
}
return $this;
}
public function getNextUpdate(): ?\DateTimeImmutable
{
return $this->nextUpdate;
}
public function setNextUpdate(\DateTimeImmutable $nextUpdate): self
{
$this->nextUpdate = $nextUpdate;
return $this;
}
public function getIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getDisablingReason(): ?string
{
return $this->disablingReason;
}
public function setDisablingReason(?string $disablingReason): self
{
$this->disablingReason = $disablingReason;
return $this;
}
public function getStripeSubscriptionId(): ?string
{
return $this->stripeSubscriptionId;
}
public function setStripeSubscriptionId(?string $stripeSubscriptionId): self
{
$this->stripeSubscriptionId = $stripeSubscriptionId;
return $this;
}
}