<?phpnamespace App\Entity;use App\Repository\ShopProduitRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=ShopProduitRepository::class) * */class ShopProduit{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $intitule; /** * @ORM\Column(type="string", length=255) */ private $descriptif; /** * @ORM\ManyToOne(targetEntity=ShopCategorie::class, inversedBy="shopProduits") */ private $categorie; /** * @ORM\Column(type="integer") */ private $points; /** * @ORM\Column(type="float", nullable=true) */ private $price; /** * @ORM\OneToMany(targetEntity=ShopOrderProduct::class, mappedBy="product") */ private $shopOrderProducts; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $illustration; public function __construct() { $this->shopCommandes = new ArrayCollection(); $this->shopOrderProducts = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getIntitule(): ?string { return $this->intitule; } public function setIntitule(string $intitule): self { $this->intitule = $intitule; return $this; } public function getDescriptif(): ?string { return $this->descriptif; } public function setDescriptif(string $descriptif): self { $this->descriptif = $descriptif; return $this; } public function getCategorie(): ?ShopCategorie { return $this->categorie; } public function setCategorie(?ShopCategorie $categorie): self { $this->categorie = $categorie; return $this; } public function getPoints(): ?int { return $this->points; } public function setPoints(int $points): self { $this->points = $points; return $this; } public function getPrice(): ?float { return $this->price; } public function setPrice(?float $price): self { $this->price = $price; return $this; } /** * @return Collection|ShopOrderProduct[] */ public function getShopOrderProducts(): Collection { return $this->shopOrderProducts; } public function addShopOrderProduct(ShopOrderProduct $shopOrderProduct): self { if (!$this->shopOrderProducts->contains($shopOrderProduct)) { $this->shopOrderProducts[] = $shopOrderProduct; $shopOrderProduct->setProduct($this); } return $this; } public function removeShopOrderProduct(ShopOrderProduct $shopOrderProduct): self { if ($this->shopOrderProducts->removeElement($shopOrderProduct)) { // set the owning side to null (unless already changed) if ($shopOrderProduct->getProduct() === $this) { $shopOrderProduct->setProduct(null); } } return $this; } public function getDomaine(): ?string { $domaine = $this->categorie->getDomaine(); if($domaine == null){ $domaine = $this->categorie->getSlug(); } return $domaine; } public function getIllustration(): ?string { return $this->illustration; } public function setIllustration(?string $illustration): self { $this->illustration = $illustration; return $this; }}