Deprecated: Constant E_STRICT is deprecated in /var/www/PixelForce/vendor/symfony/error-handler/ErrorHandler.php on line 58

Deprecated: Constant E_STRICT is deprecated in /var/www/PixelForce/vendor/symfony/error-handler/ErrorHandler.php on line 76
Symfony Profiler

src/Entity/Produit.php line 121

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProduitRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Entity\Categorie;
  7. use Exception;
  8. use JsonSerializable;
  9. /**
  10.  * @ORM\Entity(repositoryClass=ProduitRepository::class)
  11.  */
  12. class Produit implements JsonSerializable
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $nom;
  24.     /**
  25.      * @ORM\Column(type="string", length=800, nullable=true)
  26.      */
  27.     private $description;
  28.     /**
  29.      * @ORM\Column(type="decimal", precision=10, scale=3)
  30.      */
  31.     private $prix;
  32.     /**
  33.      * @ORM\Column(type="string", length=255, nullable=true)
  34.      */
  35.     private $photo;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity=Secteur::class, inversedBy="produits")
  38.      * @ORM\JoinColumn(nullable=false)
  39.      */
  40.     private $secteur;
  41.     /**
  42.      * @ORM\Column(type="integer")
  43.      */
  44.     private $statut;
  45.     /**
  46.      * @ORM\ManyToOne(targetEntity="Categorie", inversedBy="products")
  47.      * @ORM\JoinColumn(name="id_categorie", referencedColumnName="id")
  48.      */
  49.     private $categorie;
  50.     /**
  51.      * @ORM\OneToOne(targetEntity=ProduitQteStock::class, mappedBy="produit")
  52.      */
  53.     private $produitQteStock;
  54.     private $estFavori;
  55.     public function getId(): ?int
  56.     {
  57.         return $this->id;
  58.     }
  59.     public function getNom(): ?string
  60.     {
  61.         return $this->nom;
  62.     }
  63.     public function setNom(string $nom): self
  64.     {
  65.         $this->nom $nom;
  66.         return $this;
  67.     }
  68.     public function getDescription(): ?string
  69.     {
  70.         return $this->description;
  71.     }
  72.     public function setDescription(?string $description): self
  73.     {
  74.         $this->description $description;
  75.         return $this;
  76.     }
  77.     public function getPrix()
  78.     {
  79.         return $this->prix;
  80.     }
  81.     public function setPrix($prix): self
  82.     {
  83.         $this->prix $prix;
  84.         return $this;
  85.     }
  86.     public function getPhoto(): ?string
  87.     {
  88.         return $this->photo;
  89.     }
  90.     public function setPhoto(?string $photo): self
  91.     {
  92.         $this->photo $photo;
  93.         return $this;
  94.     }
  95.     public function jsonSerialize()
  96.     {
  97.         $vars get_object_vars($this);
  98.         return $vars;
  99.     }
  100.     public function getSecteur(): ?Secteur
  101.     {
  102.         return $this->secteur;
  103.     }
  104.     public function setSecteur(?Secteur $secteur): self
  105.     {
  106.         $this->secteur $secteur;
  107.         return $this;
  108.     }
  109.     public function getStatut(): ?int
  110.     {
  111.         return $this->statut;
  112.     }
  113.     public function setStatut(int $statut): self
  114.     {
  115.         $this->statut $statut;
  116.         return $this;
  117.     }
  118.     /**
  119.      * Get the value of categorie
  120.      */ 
  121.     public function getCategorie(): ?Categorie
  122.     {
  123.         return $this->categorie;
  124.     }
  125.     /**
  126.      * Set the value of categorie
  127.      *
  128.      * @return  self
  129.      */ 
  130.     public function setCategorie(Categorie $categorie)
  131.     {
  132.         $this->categorie $categorie;
  133.         return $this;
  134.     }
  135.     public function getProduitQteStock(): ?ProduitQteStock
  136.     {
  137.         return $this->produitQteStock;
  138.     }
  139.     public function setProduitQteStock(ProduitQteStock $produitQteStock): self
  140.     {
  141.         // set the owning side of the relation if necessary
  142.         if ($produitQteStock->getProduit() !== $this) {
  143.             $produitQteStock->setProduit($this);
  144.         }
  145.         $this->produitQteStock $produitQteStock;
  146.         return $this;
  147.     }
  148.     public function checkQty(float $qty){
  149.         if($qty $this->getProduitQteStock()->getQteStock()){
  150.             throw new Exception("Stock insuffisant pour le produit <<".$this->getNom().">>, Quantité restante: ".$this->getProduitQteStock()->getQteStock());
  151.         }
  152.     }
  153.     
  154.     /**
  155.      * Get the value of estFavori
  156.      */ 
  157.     public function getEstFavori()
  158.     {
  159.         return $this->estFavori;
  160.     }
  161.     /**
  162.      * Set the value of estFavori
  163.      *
  164.      * @return  self
  165.      */ 
  166.     public function setEstFavori($estFavori)
  167.     {
  168.         $this->estFavori $estFavori;
  169.         return $this;
  170.     }
  171. }