<?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 $stripeId;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private string $customerId;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private string $sessionId;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private string $methodPayment;
/**
* @ORM\Column(type="boolean")
*/
private bool $actif = false;
/**
* @ORM\ManyToOne(targetEntity=Enterprise::class, inversedBy="abonnements")
*/
private Enterprise $enterprise;
/**
* @ORM\Column(type="string", length=255)
*/
private $email;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="float")
*/
private $price;
/**
* @ORM\OneToMany(mappedBy="abonnement", targetEntity=Facture::class, cascade={"persist"})
*/
private $invoices;
public function __construct()
{
$this->invoices = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getStripeId(): ?string
{
return $this->stripeId;
}
public function setStripeId(string $stripeId): self
{
$this->stripeId = $stripeId;
return $this;
}
public function setActif(bool $actif): self
{
$this->actif = $actif;
return $this;
}
public function getEnterprise(): Enterprise
{
return $this->enterprise;
}
public function setEnterprise(Enterprise $enterprise): self
{
$this->enterprise = $enterprise;
return $this;
}
public function getCustomerId(): string
{
return $this->customerId;
}
public function setCustomerId(string $customerId): void
{
$this->customerId = $customerId;
}
public function getSessionId(): string
{
return $this->sessionId;
}
public function setSessionId(string $sessionId): void
{
$this->sessionId = $sessionId;
}
public function getMethodPayment(): string
{
return $this->methodPayment;
}
public function setMethodPayment(string $methodPayment): void
{
$this->methodPayment = $methodPayment;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function isActif()
{
return $this->actif;
}
public function getPrice()
{
return $this->price;
}
public function setPrice($price): void
{
$this->price = $price;
}
/**
* @return ArrayCollection|Collection|array<Facture>
*/
public function getInvoices(): ArrayCollection|Collection|array
{
return $this->invoices;
}
public function addInvoice(Facture $invoice): self
{
if (! $this->invoices->contains($invoice)) {
$this->invoices[] = $invoice;
$invoice->setAbonnement($this);
}
return $this;
}
public function removeInvoice(Facture $invoice): self
{
if ($this->invoices->removeElement($invoice)) {
// set the owning side to null (unless already changed)
if ($invoice->getAbonnement() === $this) {
$invoice->setAbonnement(null);
}
}
return $this;
}
}