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\Column(length50nullabletrue)]
  29.     private ?string $type null;
  30.     #[ORM\OneToMany(mappedBy'vente'targetEntityFacture::class)]
  31.     private Collection $factures;
  32.     #[ORM\ManyToOne(inversedBy'ventes')]
  33.     private ?Boutique $boutique null;
  34.     #[ORM\OneToMany(mappedBy'vente'targetEntityRecette::class)]
  35.     private Collection $recettes;
  36.     public function __construct()
  37.     {
  38.         $this->dateVente = new \DateTime();
  39.         $this->detailsVentes = new ArrayCollection();
  40.         $this->echeances = new ArrayCollection();
  41.         $this->factures = new ArrayCollection();
  42.         $this->recettes = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getDateVente(): ?\DateTimeInterface
  49.     {
  50.         return $this->dateVente;
  51.     }
  52.     public function setDateVente(\DateTimeInterface $dateVente): static
  53.     {
  54.         $this->dateVente $dateVente;
  55.         return $this;
  56.     }
  57.     public function getVendeur(): ?User
  58.     {
  59.         return $this->vendeur;
  60.     }
  61.     public function setVendeur(?User $vendeur): static
  62.     {
  63.         $this->vendeur $vendeur;
  64.         return $this;
  65.     }
  66.     /**
  67.      * @return Collection<int, DetailsVente>
  68.      */
  69.     public function getDetailsVentes(): Collection
  70.     {
  71.         return $this->detailsVentes;
  72.     }
  73.     public function addDetailsVente(DetailsVente $detailsVente): static
  74.     {
  75.         if (!$this->detailsVentes->contains($detailsVente)) {
  76.             $this->detailsVentes->add($detailsVente);
  77.             $detailsVente->setVente($this);
  78.         }
  79.         return $this;
  80.     }
  81.     public function removeDetailsVente(DetailsVente $detailsVente): static
  82.     {
  83.         if ($this->detailsVentes->removeElement($detailsVente)) {
  84.             // set the owning side to null (unless already changed)
  85.             if ($detailsVente->getVente() === $this) {
  86.                 $detailsVente->setVente(null);
  87.             }
  88.         }
  89.         return $this;
  90.     }
  91.     /**
  92.      * @return Collection<int, Echeance>
  93.      */
  94.     public function getEcheances(): Collection
  95.     {
  96.         return $this->echeances;
  97.     }
  98.     public function addEcheance(Echeance $echeance): static
  99.     {
  100.         if (!$this->echeances->contains($echeance)) {
  101.             $this->echeances->add($echeance);
  102.             $echeance->setVente($this);
  103.         }
  104.         return $this;
  105.     }
  106.     public function removeEcheance(Echeance $echeance): static
  107.     {
  108.         if ($this->echeances->removeElement($echeance)) {
  109.             // set the owning side to null (unless already changed)
  110.             if ($echeance->getVente() === $this) {
  111.                 $echeance->setVente(null);
  112.             }
  113.         }
  114.         return $this;
  115.     }
  116.     public function getClient(): ?Client
  117.     {
  118.         return $this->client;
  119.     }
  120.     public function setClient(?Client $client): static
  121.     {
  122.         $this->client $client;
  123.         return $this;
  124.     }
  125.     public function getDescription(): ?string
  126.     {
  127.         return $this->description;
  128.     }
  129.     public function setDescription(?string $description): static
  130.     {
  131.         $this->description $description;
  132.         return $this;
  133.     }
  134.     public function getType(): ?string
  135.     {
  136.         return $this->type;
  137.     }
  138.     public function setType(?string $type): static
  139.     {
  140.         $this->type $type;
  141.         return $this;
  142.     }
  143.     /**
  144.      * @return Collection<int, Facture>
  145.      */
  146.     public function getFactures(): Collection
  147.     {
  148.         return $this->factures;
  149.     }
  150.     public function addFacture(Facture $facture): static
  151.     {
  152.         if (!$this->factures->contains($facture)) {
  153.             $this->factures->add($facture);
  154.             $facture->setVente($this);
  155.         }
  156.         return $this;
  157.     }
  158.     public function removeFacture(Facture $facture): static
  159.     {
  160.         if ($this->factures->removeElement($facture)) {
  161.             // set the owning side to null (unless already changed)
  162.             if ($facture->getVente() === $this) {
  163.                 $facture->setVente(null);
  164.             }
  165.         }
  166.         return $this;
  167.     }
  168.     public function getBoutique(): ?Boutique
  169.     {
  170.         return $this->boutique;
  171.     }
  172.     public function setBoutique(?Boutique $boutique): static
  173.     {
  174.         $this->boutique $boutique;
  175.         return $this;
  176.     }
  177.     /**
  178.      * @return Collection<int, Recette>
  179.      */
  180.     public function getRecettes(): Collection
  181.     {
  182.         return $this->recettes;
  183.     }
  184.     public function addRecette(Recette $recette): static
  185.     {
  186.         if (!$this->recettes->contains($recette)) {
  187.             $this->recettes->add($recette);
  188.             $recette->setVente($this);
  189.         }
  190.         return $this;
  191.     }
  192.     public function removeRecette(Recette $recette): static
  193.     {
  194.         if ($this->recettes->removeElement($recette)) {
  195.             // set the owning side to null (unless already changed)
  196.             if ($recette->getVente() === $this) {
  197.                 $recette->setVente(null);
  198.             }
  199.         }
  200.         return $this;
  201.     }
  202. }