src/Entity/Produit.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProduitRepository;
  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. use Symfony\Component\HttpFoundation\File\File;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. #[ORM\Entity(repositoryClassProduitRepository::class)]
  11. #[Vich\Uploadable]
  12. class Produit
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $Nom null;
  20.     #[ORM\Column(length255,nullabletrue)]
  21.     private ?string $Description null;
  22.     #[ORM\Column(nullabletrue)]
  23.     private ?int $prixUnitaire null;
  24.     #[ORM\ManyToOne(inversedBy'produits')]
  25.     #[ORM\JoinColumn(nullablefalse)]
  26.     private ?Categorie $categorie null;
  27.   
  28.     #[ORM\OneToMany(mappedBy'produit'targetEntityEntreeStock::class)]
  29.     private Collection $entreeStocks;
  30.     #[ORM\OneToMany(mappedBy'produit'targetEntitySortieStock::class)]
  31.     private Collection $sortieStocks;
  32.     #[ORM\ManyToOne(inversedBy'produits')]
  33.     private ?User $utilisateur null;
  34.     
  35.     #[ORM\Column(nullabletrue)]
  36.     private ?int $quantitePr null;
  37.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  38.     private ?string $cout null;
  39.     
  40.     
  41.     #[Vich\UploadableField(mapping'produit'fileNameProperty'imageName', )]
  42.     private ?File $imageFile null;
  43.     #[ORM\Column(nullabletrue)]
  44.     private ?string $imageName null;
  45.     
  46.     #[ORM\Column(nullabletrue)]
  47.     private ?\DateTimeImmutable $updatedAt null;
  48.     #[ORM\Column(length255nullabletrue)]
  49.     private ?string $uniteMesure null;
  50.     #[ORM\OneToMany(mappedBy'produit'targetEntityDetailsVente::class, cascade: ['remove'], orphanRemovaltrue)]
  51.     private Collection $detailsVentes;
  52.     #[ORM\OneToMany(mappedBy'produit'targetEntityLivraisonProd::class, cascade: ['remove'], orphanRemovaltrue)]
  53.     private Collection $livraisonProds;
  54.     #[ORM\OneToMany(mappedBy'produit'targetEntityProduitStock::class)]
  55.     private Collection $produitStocks;
  56.     #[ORM\Column(nullabletrue)]
  57.     private ?float $prixVenteUnitaire null;
  58.     public function __construct()
  59.     {
  60.         $this->entreeStocks = new ArrayCollection();
  61.         $this->sortieStocks = new ArrayCollection();
  62.         $this->detailsVentes = new ArrayCollection();
  63.         $this->updatedAt = new \DateTimeImmutable('now');
  64.         $this->livraisonProds = new ArrayCollection();
  65.         $this->produitStocks = new ArrayCollection();
  66.         $this->prixVenteUnitaire 0;
  67.     }
  68.     public function getId(): ?int
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getNom(): ?string
  73.     {
  74.         return $this->Nom;
  75.     }
  76.     public function setNom(string $Nom): static
  77.     {
  78.         $this->Nom $Nom;
  79.         return $this;
  80.     }
  81.     public function getDescription(): ?string
  82.     {
  83.         return $this->Description;
  84.     }
  85.     public function setDescription(string $Description): static
  86.     {
  87.         $this->Description $Description;
  88.         return $this;
  89.     }
  90.     public function getPrixUnitaire(): ?int
  91.     {
  92.         return $this->prixUnitaire;
  93.     }
  94.     public function setPrixUnitaire(int $prixUnitaire): static
  95.     {
  96.         $this->prixUnitaire $prixUnitaire;
  97.         return $this;
  98.     }
  99.    
  100.     
  101.     public function getCategorie(): ?Categorie
  102.     {
  103.         return $this->categorie;
  104.     }
  105.     public function setCategorie(?Categorie $categorie): static
  106.     {
  107.         $this->categorie $categorie;
  108.         return $this;
  109.     }
  110.  
  111.    
  112.     /**
  113.      * @return Collection<int, EntreeStock>
  114.      */
  115.     public function getEntreeStocks(): Collection
  116.     {
  117.         return $this->entreeStocks;
  118.     }
  119.     public function addEntreeStock(EntreeStock $entreeStock): static
  120.     {
  121.         if (!$this->entreeStocks->contains($entreeStock)) {
  122.             $this->entreeStocks->add($entreeStock);
  123.             $entreeStock->setProduit($this);
  124.         }
  125.         return $this;
  126.     }
  127.     public function removeEntreeStock(EntreeStock $entreeStock): static
  128.     {
  129.         if ($this->entreeStocks->removeElement($entreeStock)) {
  130.             // set the owning side to null (unless already changed)
  131.             if ($entreeStock->getProduit() === $this) {
  132.                 $entreeStock->setProduit(null);
  133.             }
  134.         }
  135.         return $this;
  136.     }
  137.     /**
  138.      * @return Collection<int, SortieStock>
  139.      */
  140.     public function getSortieStocks(): Collection
  141.     {
  142.         return $this->sortieStocks;
  143.     }
  144.     public function addSortieStock(SortieStock $sortieStock): static
  145.     {
  146.         if (!$this->sortieStocks->contains($sortieStock)) {
  147.             $this->sortieStocks->add($sortieStock);
  148.             $sortieStock->setProduit($this);
  149.         }
  150.         return $this;
  151.     }
  152.     public function removeSortieStock(SortieStock $sortieStock): static
  153.     {
  154.         if ($this->sortieStocks->removeElement($sortieStock)) {
  155.             // set the owning side to null (unless already changed)
  156.             if ($sortieStock->getProduit() === $this) {
  157.                 $sortieStock->setProduit(null);
  158.             }
  159.         }
  160.         return $this;
  161.     }
  162.     public function setImageFile(?File $imageFile null): void
  163.     {
  164.         $this->imageFile $imageFile;
  165.         if (null !== $imageFile) {
  166.             
  167.             $this->updatedAt = new \DateTimeImmutable('now');
  168.         }
  169.     }
  170.     public function getImageFile(): ?File
  171.     {
  172.         return $this->imageFile;
  173.     }
  174.     public function setImageName(?string $imageName): void
  175.     {
  176.         $this->imageName $imageName;
  177.     }
  178.     public function getImageName(): ?string
  179.     {
  180.         return $this->imageName;
  181.     }
  182.     public function getUtilisateur(): ?User
  183.     {
  184.         return $this->utilisateur;
  185.     }
  186.     public function setUtilisateur(?User $utilisateur): static
  187.     {
  188.         $this->utilisateur $utilisateur;
  189.         return $this;
  190.     }
  191.    
  192.     
  193.     public function getQuantitePr(): ?int
  194.     {
  195.         return $this->quantitePr;
  196.     }
  197.     public function setQuantitePr(?int $quantitePr): static
  198.     {
  199.         $this->quantitePr $quantitePr;
  200.         return $this;
  201.     }
  202.     public function getCout(): ?string
  203.     {
  204.         return $this->cout;
  205.     }
  206.     public function setCout(?string $cout): static
  207.     {
  208.         $this->cout $cout;
  209.         return $this;
  210.     }
  211.     
  212.     
  213.   
  214.     public function getUniteMesure(): ?string
  215.     {
  216.         return $this->uniteMesure;
  217.     }
  218.     public function setUniteMesure(?string $uniteMesure): static
  219.     {
  220.         $this->uniteMesure $uniteMesure;
  221.         return $this;
  222.     }
  223.     /**
  224.      * @return Collection<int, DetailsVente>
  225.      */
  226.     public function getDetailsVentes(): Collection
  227.     {
  228.         return $this->detailsVentes;
  229.     }
  230.     public function addDetailsVente(DetailsVente $detailsVente): static
  231.     {
  232.         if (!$this->detailsVentes->contains($detailsVente)) {
  233.             $this->detailsVentes->add($detailsVente);
  234.             $detailsVente->setProduit($this);
  235.         }
  236.         return $this;
  237.     }
  238.     public function removeDetailsVente(DetailsVente $detailsVente): static
  239.     {
  240.         if ($this->detailsVentes->removeElement($detailsVente)) {
  241.             // set the owning side to null (unless already changed)
  242.             if ($detailsVente->getProduit() === $this) {
  243.                 $detailsVente->setProduit(null);
  244.             }
  245.         }
  246.         return $this;
  247.     }
  248.     /**
  249.      * @return Collection<int, LivraisonProd>
  250.      */
  251.     public function getLivraisonProds(): Collection
  252.     {
  253.         return $this->livraisonProds;
  254.     }
  255.     public function addLivraisonProd(LivraisonProd $livraisonProd): static
  256.     {
  257.         if (!$this->livraisonProds->contains($livraisonProd)) {
  258.             $this->livraisonProds->add($livraisonProd);
  259.             $livraisonProd->setProduit($this);
  260.         }
  261.         return $this;
  262.     }
  263.     public function removeLivraisonProd(LivraisonProd $livraisonProd): static
  264.     {
  265.         if ($this->livraisonProds->removeElement($livraisonProd)) {
  266.             // set the owning side to null (unless already changed)
  267.             if ($livraisonProd->getProduit() === $this) {
  268.                 $livraisonProd->setProduit(null);
  269.             }
  270.         }
  271.         return $this;
  272.     }
  273.     /**
  274.      * @return Collection<int, ProduitStock>
  275.      */
  276.     public function getProduitStocks(): Collection
  277.     {
  278.         return $this->produitStocks;
  279.     }
  280.     public function addProduitStock(ProduitStock $produitStock): static
  281.     {
  282.         if (!$this->produitStocks->contains($produitStock)) {
  283.             $this->produitStocks->add($produitStock);
  284.             $produitStock->setProduit($this);
  285.         }
  286.         return $this;
  287.     }
  288.     public function removeProduitStock(ProduitStock $produitStock): static
  289.     {
  290.         if ($this->produitStocks->removeElement($produitStock)) {
  291.             // set the owning side to null (unless already changed)
  292.             if ($produitStock->getProduit() === $this) {
  293.                 $produitStock->setProduit(null);
  294.             }
  295.         }
  296.         return $this;
  297.     }
  298.     public function getPrixVenteUnitaire(): ?float
  299.     {
  300.         return $this->prixVenteUnitaire;
  301.     }
  302.     public function setPrixVenteUnitaire(?float $prixVenteUnitaire): static
  303.     {
  304.         $this->prixVenteUnitaire $prixVenteUnitaire;
  305.         return $this;
  306.     }
  307. }