src/Entity/Recette.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Doctrine\ORM\Mapping\Entity;
  7. use Doctrine\ORM\Mapping\Table;
  8. use Doctrine\ORM\Mapping\Id;
  9. use Doctrine\ORM\Mapping\GeneratedValue;
  10. use Doctrine\ORM\Mapping\Column;
  11. use Doctrine\ORM\Mapping\ManyToMany;
  12. use Doctrine\ORM\Mapping\OneToMany;
  13. #[Entity]
  14. #[Table(name"recette")]
  15. class Recette
  16. {
  17.     #[Id]
  18.     #[GeneratedValue]
  19.     #[Column(type"integer")]
  20.     private int $id;
  21.     #[Column(type"datetime")]
  22.     private \DateTimeInterface $date;
  23.     #[ManyToMany(targetEntityPrestation::class)]
  24.     #[ORM\JoinTable(name"recette_prestation",
  25.         joinColumns: [new ORM\JoinColumn(name"recette_id"referencedColumnName"id")],
  26.         inverseJoinColumns: [new ORM\JoinColumn(name"prestation_id"referencedColumnName"id")]
  27.     )]
  28.     private Collection $prestations;
  29.     #[OneToMany(targetEntityPaiementRecette::class, mappedBy"recette"cascade: ["persist""remove"])]
  30.     private Collection $paiements;
  31.     #[Column(type"string"length255nullabletrue)]
  32.     private ?string $nomClient null;
  33.     #[Column(type"decimal"scale2nullabletrue)]
  34.     private ?float $acompte null;
  35.     #[Column(type"decimal"scale2nullabletrue)]
  36.     private ?float $total null;
  37.     public function __construct()
  38.     {
  39.         $this->prestations = new ArrayCollection();
  40.         $this->paiements = new ArrayCollection();
  41.     }
  42.     public function getId(): int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getDate(): \DateTimeInterface
  47.     {
  48.         return $this->date;
  49.     }
  50.     public function setDate(\DateTimeInterface $date): void
  51.     {
  52.         $this->date $date;
  53.     }
  54.     public function getPrestations(): Collection
  55.     {
  56.         return $this->prestations;
  57.     }
  58.     public function addPrestation(Prestation $prestation): self
  59.     {
  60.         if (!$this->prestations->contains($prestation)) {
  61.             $this->prestations->add($prestation);
  62.         }
  63.         return $this;
  64.     }
  65.     public function removePrestation(Prestation $prestation): self
  66.     {
  67.         $this->prestations->removeElement($prestation);
  68.         return $this;
  69.     }
  70.     public function getPaiements(): Collection
  71.     {
  72.         return $this->paiements;
  73.     }
  74.     public function addPaiement(PaiementRecette $paiement): self
  75.     {
  76.         if (!$this->paiements->contains($paiement)) {
  77.             $this->paiements->add($paiement);
  78.             $paiement->setRecette($this);
  79.         }
  80.         return $this;
  81.     }
  82.     public function removePaiement(PaiementRecette $paiement): self
  83.     {
  84.         if ($this->paiements->removeElement($paiement)) {
  85.             // set the owning side to null (unless already changed)
  86.             if ($paiement->getRecette() === $this) {
  87.                 $paiement->setRecette(null);
  88.             }
  89.         }
  90.         return $this;
  91.     }
  92.     public function getNomClient(): ?string
  93.     {
  94.         return $this->nomClient;
  95.     }
  96.     public function setNomClient(?string $nomClient): void
  97.     {
  98.         $this->nomClient $nomClient;
  99.     }
  100.     public function getAcompte(): ?float
  101.     {
  102.         return $this->acompte;
  103.     }
  104.     public function setAcompte(?float $acompte): void
  105.     {
  106.         $this->acompte $acompte;
  107.     }
  108.     public function getTotal(): ?float
  109.     {
  110.         return $this->total;
  111.     }
  112.     public function setTotal(?float $total): void
  113.     {
  114.         $this->total $total;
  115.     }
  116. }