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 $stripeId;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private string $customerId;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private string $sessionId;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private string $methodPayment;
  34.     /**
  35.      * @ORM\Column(type="boolean")
  36.      */
  37.     private bool $actif false;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=Enterprise::class, inversedBy="abonnements")
  40.      */
  41.     private Enterprise $enterprise;
  42.     /**
  43.      * @ORM\Column(type="string", length=255)
  44.      */
  45.     private $email;
  46.     /**
  47.      * @ORM\Column(type="string", length=255)
  48.      */
  49.     private $name;
  50.     /**
  51.      * @ORM\Column(type="float")
  52.      */
  53.     private $price;
  54.     /**
  55.      * @ORM\OneToMany(mappedBy="abonnement", targetEntity=Facture::class, cascade={"persist"})
  56.      */
  57.     private $invoices;
  58.     public function __construct()
  59.     {
  60.         $this->invoices = new ArrayCollection();
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getUser(): ?User
  67.     {
  68.         return $this->user;
  69.     }
  70.     public function setUser(?User $user): self
  71.     {
  72.         $this->user $user;
  73.         return $this;
  74.     }
  75.     public function getStripeId(): ?string
  76.     {
  77.         return $this->stripeId;
  78.     }
  79.     public function setStripeId(string $stripeId): self
  80.     {
  81.         $this->stripeId $stripeId;
  82.         return $this;
  83.     }
  84.     public function setActif(bool $actif): self
  85.     {
  86.         $this->actif $actif;
  87.         return $this;
  88.     }
  89.     public function getEnterprise(): Enterprise
  90.     {
  91.         return $this->enterprise;
  92.     }
  93.     public function setEnterprise(Enterprise $enterprise): self
  94.     {
  95.         $this->enterprise $enterprise;
  96.         return $this;
  97.     }
  98.     public function getCustomerId(): string
  99.     {
  100.         return $this->customerId;
  101.     }
  102.     public function setCustomerId(string $customerId): void
  103.     {
  104.         $this->customerId $customerId;
  105.     }
  106.     public function getSessionId(): string
  107.     {
  108.         return $this->sessionId;
  109.     }
  110.     public function setSessionId(string $sessionId): void
  111.     {
  112.         $this->sessionId $sessionId;
  113.     }
  114.     public function getMethodPayment(): string
  115.     {
  116.         return $this->methodPayment;
  117.     }
  118.     public function setMethodPayment(string $methodPayment): void
  119.     {
  120.         $this->methodPayment $methodPayment;
  121.     }
  122.     public function getEmail(): ?string
  123.     {
  124.         return $this->email;
  125.     }
  126.     public function setEmail(string $email): self
  127.     {
  128.         $this->email $email;
  129.         return $this;
  130.     }
  131.     public function getName(): ?string
  132.     {
  133.         return $this->name;
  134.     }
  135.     public function setName(string $name): self
  136.     {
  137.         $this->name $name;
  138.         return $this;
  139.     }
  140.     public function isActif()
  141.     {
  142.         return $this->actif;
  143.     }
  144.     public function getPrice()
  145.     {
  146.         return $this->price;
  147.     }
  148.     public function setPrice($price): void
  149.     {
  150.         $this->price $price;
  151.     }
  152.     /**
  153.      * @return ArrayCollection|Collection|array<Facture>
  154.      */
  155.     public function getInvoices(): ArrayCollection|Collection|array
  156.     {
  157.         return $this->invoices;
  158.     }
  159.     public function addInvoice(Facture $invoice): self
  160.     {
  161.         if (! $this->invoices->contains($invoice)) {
  162.             $this->invoices[] = $invoice;
  163.             $invoice->setAbonnement($this);
  164.         }
  165.         return $this;
  166.     }
  167.     public function removeInvoice(Facture $invoice): self
  168.     {
  169.         if ($this->invoices->removeElement($invoice)) {
  170.             // set the owning side to null (unless already changed)
  171.             if ($invoice->getAbonnement() === $this) {
  172.                 $invoice->setAbonnement(null);
  173.             }
  174.         }
  175.         return $this;
  176.     }
  177. }