src/Entity/Vente.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\VenteRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassVenteRepository::class)]
  9. class Vente
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  16.     private ?\DateTimeInterface $dateVente null;
  17.     #[ORM\ManyToOne]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private ?User $vendeur null;
  20.     #[ORM\OneToMany(mappedBy'vente'targetEntityDetailsVente::class)]
  21.     private Collection $detailsVentes;
  22.     #[ORM\OneToMany(mappedBy'vente'targetEntityEcheance::class)]
  23.     private Collection $echeances;
  24.     #[ORM\ManyToOne(inversedBy'ventes')]
  25.     private ?Client $client null;
  26.     #[ORM\Column(length500nullabletrue)]
  27.     private ?string $description null;
  28.     #[ORM\OneToMany(mappedBy'vente'targetEntityFacture::class)]
  29.     private Collection $factures;
  30.     #[ORM\ManyToOne(inversedBy'ventes')]
  31.     private ?Boutique $boutique null;
  32.     #[ORM\OneToMany(mappedBy'vente'targetEntityRecette::class)]
  33.     private Collection $recettes;
  34.     public function __construct()
  35.     {
  36.         $this->dateVente = new \DateTime();
  37.         $this->detailsVentes = new ArrayCollection();
  38.         $this->echeances = new ArrayCollection();
  39.         $this->factures = new ArrayCollection();
  40.         $this->recettes = new ArrayCollection();
  41.     }
  42.     public function getId(): ?int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getDateVente(): ?\DateTimeInterface
  47.     {
  48.         return $this->dateVente;
  49.     }
  50.     public function setDateVente(\DateTimeInterface $dateVente): static
  51.     {
  52.         $this->dateVente $dateVente;
  53.         return $this;
  54.     }
  55.     public function getVendeur(): ?User
  56.     {
  57.         return $this->vendeur;
  58.     }
  59.     public function setVendeur(?User $vendeur): static
  60.     {
  61.         $this->vendeur $vendeur;
  62.         return $this;
  63.     }
  64.     /**
  65.      * @return Collection<int, DetailsVente>
  66.      */
  67.     public function getDetailsVentes(): Collection
  68.     {
  69.         return $this->detailsVentes;
  70.     }
  71.     public function addDetailsVente(DetailsVente $detailsVente): static
  72.     {
  73.         if (!$this->detailsVentes->contains($detailsVente)) {
  74.             $this->detailsVentes->add($detailsVente);
  75.             $detailsVente->setVente($this);
  76.         }
  77.         return $this;
  78.     }
  79.     public function removeDetailsVente(DetailsVente $detailsVente): static
  80.     {
  81.         if ($this->detailsVentes->removeElement($detailsVente)) {
  82.             // set the owning side to null (unless already changed)
  83.             if ($detailsVente->getVente() === $this) {
  84.                 $detailsVente->setVente(null);
  85.             }
  86.         }
  87.         return $this;
  88.     }
  89.     /**
  90.      * @return Collection<int, Echeance>
  91.      */
  92.     public function getEcheances(): Collection
  93.     {
  94.         return $this->echeances;
  95.     }
  96.     public function addEcheance(Echeance $echeance): static
  97.     {
  98.         if (!$this->echeances->contains($echeance)) {
  99.             $this->echeances->add($echeance);
  100.             $echeance->setVente($this);
  101.         }
  102.         return $this;
  103.     }
  104.     public function removeEcheance(Echeance $echeance): static
  105.     {
  106.         if ($this->echeances->removeElement($echeance)) {
  107.             // set the owning side to null (unless already changed)
  108.             if ($echeance->getVente() === $this) {
  109.                 $echeance->setVente(null);
  110.             }
  111.         }
  112.         return $this;
  113.     }
  114.     public function getClient(): ?Client
  115.     {
  116.         return $this->client;
  117.     }
  118.     public function setClient(?Client $client): static
  119.     {
  120.         $this->client $client;
  121.         return $this;
  122.     }
  123.     public function getDescription(): ?string
  124.     {
  125.         return $this->description;
  126.     }
  127.     public function setDescription(?string $description): static
  128.     {
  129.         $this->description $description;
  130.         return $this;
  131.     }
  132.     /**
  133.      * @return Collection<int, Facture>
  134.      */
  135.     public function getFactures(): Collection
  136.     {
  137.         return $this->factures;
  138.     }
  139.     public function addFacture(Facture $facture): static
  140.     {
  141.         if (!$this->factures->contains($facture)) {
  142.             $this->factures->add($facture);
  143.             $facture->setVente($this);
  144.         }
  145.         return $this;
  146.     }
  147.     public function removeFacture(Facture $facture): static
  148.     {
  149.         if ($this->factures->removeElement($facture)) {
  150.             // set the owning side to null (unless already changed)
  151.             if ($facture->getVente() === $this) {
  152.                 $facture->setVente(null);
  153.             }
  154.         }
  155.         return $this;
  156.     }
  157.     public function getBoutique(): ?Boutique
  158.     {
  159.         return $this->boutique;
  160.     }
  161.     public function setBoutique(?Boutique $boutique): static
  162.     {
  163.         $this->boutique $boutique;
  164.         return $this;
  165.     }
  166.     /**
  167.      * @return Collection<int, Recette>
  168.      */
  169.     public function getRecettes(): Collection
  170.     {
  171.         return $this->recettes;
  172.     }
  173.     public function addRecette(Recette $recette): static
  174.     {
  175.         if (!$this->recettes->contains($recette)) {
  176.             $this->recettes->add($recette);
  177.             $recette->setVente($this);
  178.         }
  179.         return $this;
  180.     }
  181.     public function removeRecette(Recette $recette): static
  182.     {
  183.         if ($this->recettes->removeElement($recette)) {
  184.             // set the owning side to null (unless already changed)
  185.             if ($recette->getVente() === $this) {
  186.                 $recette->setVente(null);
  187.             }
  188.         }
  189.         return $this;
  190.     }
  191. }