src/Entity/ShopProduit.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ShopProduitRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ShopProduitRepository::class)
  9.  * 
  10.  */
  11. class ShopProduit
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $intitule;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $descriptif;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=ShopCategorie::class, inversedBy="shopProduits")
  29.      */
  30.     private $categorie;
  31.     /**
  32.      * @ORM\Column(type="integer")
  33.      */
  34.     private $points;
  35.     /**
  36.      * @ORM\Column(type="float", nullable=true)
  37.      */
  38.     private $price;
  39.     /**
  40.      * @ORM\OneToMany(targetEntity=ShopOrderProduct::class, mappedBy="product")
  41.      */
  42.     private $shopOrderProducts;
  43.     /**
  44.      * @ORM\Column(type="string", length=255, nullable=true)
  45.      */
  46.     private $illustration;
  47.    
  48.     public function __construct()
  49.     {
  50.         $this->shopCommandes = new ArrayCollection();
  51.         $this->shopOrderProducts = new ArrayCollection();
  52.       
  53.     }
  54.     public function getId(): ?int
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getIntitule(): ?string
  59.     {
  60.         return $this->intitule;
  61.     }
  62.     public function setIntitule(string $intitule): self
  63.     {
  64.         $this->intitule $intitule;
  65.         return $this;
  66.     }
  67.     public function getDescriptif(): ?string
  68.     {
  69.         return $this->descriptif;
  70.     }
  71.     public function setDescriptif(string $descriptif): self
  72.     {
  73.         $this->descriptif $descriptif;
  74.         return $this;
  75.     }
  76.     public function getCategorie(): ?ShopCategorie
  77.     {
  78.         return $this->categorie;
  79.     }
  80.     public function setCategorie(?ShopCategorie $categorie): self
  81.     {
  82.         $this->categorie $categorie;
  83.         return $this;
  84.     }
  85.     public function getPoints(): ?int
  86.     {
  87.         return $this->points;
  88.     }
  89.     public function setPoints(int $points): self
  90.     {
  91.         $this->points $points;
  92.         return $this;
  93.     }
  94.     public function getPrice(): ?float
  95.     {
  96.         return $this->price;
  97.     }
  98.     public function setPrice(?float $price): self
  99.     {
  100.         $this->price $price;
  101.         return $this;
  102.     }
  103.     /**
  104.      * @return Collection|ShopOrderProduct[]
  105.      */
  106.     public function getShopOrderProducts(): Collection
  107.     {
  108.         return $this->shopOrderProducts;
  109.     }
  110.     public function addShopOrderProduct(ShopOrderProduct $shopOrderProduct): self
  111.     {
  112.         if (!$this->shopOrderProducts->contains($shopOrderProduct)) {
  113.             $this->shopOrderProducts[] = $shopOrderProduct;
  114.             $shopOrderProduct->setProduct($this);
  115.         }
  116.         return $this;
  117.     }
  118.     public function removeShopOrderProduct(ShopOrderProduct $shopOrderProduct): self
  119.     {
  120.         if ($this->shopOrderProducts->removeElement($shopOrderProduct)) {
  121.             // set the owning side to null (unless already changed)
  122.             if ($shopOrderProduct->getProduct() === $this) {
  123.                 $shopOrderProduct->setProduct(null);
  124.             }
  125.         }
  126.         return $this;
  127.     }
  128.     public function getDomaine(): ?string
  129.     {
  130.         $domaine $this->categorie->getDomaine();
  131.         if($domaine == null){
  132.             $domaine $this->categorie->getSlug();
  133.         }
  134.         return $domaine;
  135.     }
  136.     public function getIllustration(): ?string
  137.     {
  138.         return $this->illustration;
  139.     }
  140.     public function setIllustration(?string $illustration): self
  141.     {
  142.         $this->illustration $illustration;
  143.         return $this;
  144.     }
  145. }