src\Entity\Facture.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FactureRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassFactureRepository::class)]
  8. class Facture
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'float'nullabletrue)]
  15.     private $montant;
  16.     #[ORM\JoinColumn(nullablefalse)]
  17.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'factures')]
  18.     private $user;
  19.     #[ORM\Column(type'datetime'nullabletrue)]
  20.     private $paid_at;
  21.     #[ORM\Column(type'datetime'nullabletrue)]
  22.     private $cancelled_at;
  23.     #[ORM\Column(type'datetime')]
  24.     private $created_at;
  25.     #[ORM\Column(type'integer'nullabletrue)]
  26.     private $type_payement;
  27.     #[ORM\OneToMany(targetEntitySouscription::class, mappedBy'facture')]
  28.     private $souscriptions;
  29.     #[ORM\Column(type'string'length255)]
  30.     private $email;
  31.     #[ORM\Column(type'string'length255)]
  32.     private $nom;
  33.     #[ORM\Column(type'string'length255)]
  34.     private $adresse;
  35.     #[ORM\Column(type'string'length255nullabletrue)]
  36.     private $adresse2;
  37.     #[ORM\Column(type'string'length255)]
  38.     private $pays;
  39.     #[ORM\Column(type'string'length255)]
  40.     private $ville;
  41.     #[ORM\Column(type'string'length255)]
  42.     private $region;
  43.     #[ORM\Column(type'string'length255)]
  44.     private $zip;
  45.     #[ORM\Column(type'string'length255)]
  46.     private $tel;
  47.     #[ORM\Column(type'integer')]
  48.     private $status;
  49.     #[ORM\Column(type'string'length255)]
  50.     private $code;
  51.     const FULL_STATUS =['impayée','Payée','Annulée'];
  52.     public function __construct()
  53.     {
  54.         $this->souscriptions = new ArrayCollection();
  55.         $this->created_at = new \DateTime();
  56.         $this->status 0;
  57.     }
  58.     public function getTax()
  59.     {
  60.         return floor(($this->montant*0.18) / ) * 5;
  61.     }
  62.     public function getFullStatus()
  63.     {
  64.         return self::FULL_STATUS[$this->status];
  65.     }
  66.     public function getId(): ?int
  67.     {
  68.         return $this->id;
  69.     }
  70.     public function getMontant(): ?float
  71.     {
  72.         return $this->montant;
  73.     }
  74.     public function setMontant(?float $montant): self
  75.     {
  76.         $this->montant $montant;
  77.         return $this;
  78.     }
  79.     public function getUser(): ?User
  80.     {
  81.         return $this->user;
  82.     }
  83.     public function setUser(?User $user): self
  84.     {
  85.         $this->user $user;
  86.         return $this;
  87.     }
  88.     public function getPaidAt(): ?\DateTimeInterface
  89.     {
  90.         return $this->paid_at;
  91.     }
  92.     public function setPaidAt(?\DateTimeInterface $paid_at): self
  93.     {
  94.         $this->paid_at $paid_at;
  95.         return $this;
  96.     }
  97.     public function getCancelledAt(): ?\DateTimeInterface
  98.     {
  99.         return $this->cancelled_at;
  100.     }
  101.     public function setCancelledAt(?\DateTimeInterface $cancelled_at): self
  102.     {
  103.         $this->cancelled_at $cancelled_at;
  104.         return $this;
  105.     }
  106.     public function getCreatedAt(): ?\DateTimeInterface
  107.     {
  108.         return $this->created_at;
  109.     }
  110.     public function setCreatedAt(\DateTimeInterface $created_at): self
  111.     {
  112.         $this->created_at $created_at;
  113.         return $this;
  114.     }
  115.     public function getTypePayement(): ?int
  116.     {
  117.         return $this->type_payement;
  118.     }
  119.     public function setTypePayement(?int $type_payement): self
  120.     {
  121.         $this->type_payement $type_payement;
  122.         return $this;
  123.     }
  124.     /**
  125.      * @return Collection|Souscription[]
  126.      */
  127.     public function getSouscriptions(): Collection
  128.     {
  129.         return $this->souscriptions;
  130.     }
  131.     public function addSouscription(Souscription $souscription): self
  132.     {
  133.         if (!$this->souscriptions->contains($souscription)) {
  134.             $this->souscriptions[] = $souscription;
  135.             $souscription->setFacture($this);
  136.         }
  137.         return $this;
  138.     }
  139.     public function removeSouscription(Souscription $souscription): self
  140.     {
  141.         if ($this->souscriptions->contains($souscription)) {
  142.             $this->souscriptions->removeElement($souscription);
  143.             // set the owning side to null (unless already changed)
  144.             if ($souscription->getFacture() === $this) {
  145.                 $souscription->setFacture(null);
  146.             }
  147.         }
  148.         return $this;
  149.     }
  150.     public function getEmail(): ?string
  151.     {
  152.         return $this->email;
  153.     }
  154.     public function setEmail(string $email): self
  155.     {
  156.         $this->email $email;
  157.         return $this;
  158.     }
  159.     public function getNom(): ?string
  160.     {
  161.         return $this->nom;
  162.     }
  163.     public function setNom(string $nom): self
  164.     {
  165.         $this->nom $nom;
  166.         return $this;
  167.     }
  168.     public function getAdresse(): ?string
  169.     {
  170.         return $this->adresse;
  171.     }
  172.     public function setAdresse(string $adresse): self
  173.     {
  174.         $this->adresse $adresse;
  175.         return $this;
  176.     }
  177.     public function getAdresse2(): ?string
  178.     {
  179.         return $this->adresse2;
  180.     }
  181.     public function setAdresse2(?string $adresse2): self
  182.     {
  183.         $this->adresse2 $adresse2;
  184.         return $this;
  185.     }
  186.     public function getPays(): ?string
  187.     {
  188.         return $this->pays;
  189.     }
  190.     public function setPays(string $pays): self
  191.     {
  192.         $this->pays $pays;
  193.         return $this;
  194.     }
  195.     public function getVille(): ?string
  196.     {
  197.         return $this->ville;
  198.     }
  199.     public function setVille(string $ville): self
  200.     {
  201.         $this->ville $ville;
  202.         return $this;
  203.     }
  204.     public function getRegion(): ?string
  205.     {
  206.         return $this->region;
  207.     }
  208.     public function setRegion(string $region): self
  209.     {
  210.         $this->region $region;
  211.         return $this;
  212.     }
  213.     public function getZip(): ?string
  214.     {
  215.         return $this->zip;
  216.     }
  217.     public function setZip(string $zip): self
  218.     {
  219.         $this->zip $zip;
  220.         return $this;
  221.     }
  222.     public function getTel(): ?string
  223.     {
  224.         return $this->tel;
  225.     }
  226.     public function setTel(string $tel): self
  227.     {
  228.         $this->tel $tel;
  229.         return $this;
  230.     }
  231.     public function getStatus(): ?int
  232.     {
  233.         return $this->status;
  234.     }
  235.     public function setStatus(int $status): self
  236.     {
  237.         $this->status $status;
  238.         return $this;
  239.     }
  240.     public function getCode(): ?string
  241.     {
  242.         return $this->code;
  243.     }
  244.     public function setCode(string $code): self
  245.     {
  246.         $this->code $code;
  247.         return $this;
  248.     }
  249. }