Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
web
/
vhosts
/
www.entreprise-traitement-humidite.fr
/
htdocs
/
src
/
Entity
/
/srv/data/web/vhosts/www.entreprise-traitement-humidite.fr/htdocs/src/Entity/Product.php
<?php namespace App\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity(repositoryClass="App\Repository\ProductRepository") */ class Product { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $title; /** * @ORM\Column(type="decimal", precision=8, scale=2) */ private $price; /** * @ORM\Column(type="text") * @Assert\NotBlank(message="La description ne peut pas ĂȘtre vide!") * @Assert\Length(min=10) */ private $shortDesc; /** * @ORM\Column(type="boolean") */ private $isActive; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="datetime") */ private $updatedAt; /** * @ORM\OneToMany(targetEntity="App\Entity\ProductImage", mappedBy="product", cascade={"persist", "remove", "merge"}) */ private $images; /** * @ORM\ManyToOne(targetEntity="App\Entity\Category", inversedBy="products") */ private $category; /** * @ORM\OneToMany(targetEntity="App\Entity\CommandProduct", mappedBy="product", orphanRemoval=true) */ private $commandProduct; /** * @ORM\ManyToOne(targetEntity="App\Entity\Weight", inversedBy="products") */ private $weight; /** * @ORM\Column(type="boolean",nullable=true) */ private $withDelivery; /** * @ORM\Column(type="decimal", precision=8, scale=2, nullable=true) */ private $priceCustomer; /** * @ORM\Column(type="text", nullable=true) */ private $humitestEnAction; /** * @ORM\ManyToOne(targetEntity=Gamme::class, inversedBy="products") */ private $gammeProduct; /** * @ORM\Column(type="boolean", nullable=true) */ private $isFlagship; /** * @ORM\Column(type="text", nullable=true) */ private $linkVideo; /** * @ORM\Column(type="boolean", nullable=true) */ private $isNewProduct; /** * @ORM\OneToMany(targetEntity=TitleCaracteristique::class, mappedBy="product") */ private $titleCaracteristique; /** * @ORM\Column(type="decimal", precision=6, scale=3) */ private $poidsKg; /** * @ORM\OneToMany(targetEntity=PriceDiscount::class, mappedBy="product") */ private $priceDiscounts; /** * @ORM\Column(type="text", nullable=true) */ private $caracteristique; /** * @ORM\Column(type="integer", nullable=true) */ private $position; public function __construct() { $this->isActive = true; $this->createdAt = new \DateTime(); $this->updatedAt = new \DateTime(); $this->sale = 0; $this->solde = 0; $this->images = new ArrayCollection(); $this->commandProduct = new ArrayCollection(); $this->titleCaracteristique = new ArrayCollection(); $this->priceDiscounts = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getPrice() { return $this->price; } public function setPrice($price): self { $this->price = $price; return $this; } public function getShortDesc(): ?string { return $this->shortDesc; } public function setShortDesc(string $shortDesc): self { $this->shortDesc = $shortDesc; return $this; } public function getIsActive(): ?bool { return $this->isActive; } public function setIsActive(bool $isActive): self { $this->isActive = $isActive; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } /** * @return Collection|ProductImage[] */ public function getImages(): Collection { return $this->images; } public function addImage(ProductImage $image): self { if (!$this->images->contains($image)) { $this->images[] = $image; $image->setProduct($this); } return $this; } public function removeImage(ProductImage $image): self { if ($this->images->contains($image)) { $this->images->removeElement($image); // set the owning side to null (unless already changed) if ($image->getProduct() === $this) { $image->setProduct(null); } } return $this; } public function getPriceSolde() { $priceSolde = $this->price; $priceSolde = $priceSolde - (($this->solde*$priceSolde)/100); return number_format($priceSolde,2); } public function getCategory(): ?Category { return $this->category; } public function setCategory(?Category $category): self { $this->category = $category; return $this; } /** * @return Collection|CommandProduct[] */ public function getCommandProduct(): Collection { return $this->commandProduct; } public function addCommandProduct(CommandProduct $commandProduct): self { if (!$this->commandProduct->contains($commandProduct)) { $this->commandProduct[] = $commandProduct; $commandProduct->setProduct($this); } return $this; } public function removeCommandProduct(CommandProduct $commandProduct): self { if ($this->commandProduct->contains($commandProduct)) { $this->commandProduct->removeElement($commandProduct); // set the owning side to null (unless already changed) if ($commandProduct->getProduct() === $this) { $commandProduct->setProduct(null); } } return $this; } public function getWeight(): ?Weight { return $this->weight; } public function setWeight(?Weight $weight): self { $this->weight = $weight; return $this; } public function getWithDelivery(): ?bool { return $this->withDelivery; } public function setWithDelivery(bool $withDelivery): self { $this->withDelivery = $withDelivery; return $this; } public function getPriceCustomer() { return $this->priceCustomer; } public function setPriceCustomer($priceCustomer): self { $this->priceCustomer = $priceCustomer; return $this; } public function getHumitestEnAction(): ?string { return $this->humitestEnAction; } public function setHumitestEnAction(?string $humitestEnAction): self { $this->humitestEnAction = $humitestEnAction; return $this; } public function getGammeProduct(): ?Gamme { return $this->gammeProduct; } public function setGammeProduct(?Gamme $gammeProduct): self { $this->gammeProduct = $gammeProduct; return $this; } public function getIsFlagship(): ?bool { return $this->isFlagship; } public function setIsFlagship(?bool $isFlagship): self { $this->isFlagship = $isFlagship; return $this; } public function getLinkVideo(): ?string { return $this->linkVideo; } public function setLinkVideo(?string $linkVideo): self { $this->linkVideo = $linkVideo; return $this; } public function getIsNewProduct(): ?bool { return $this->isNewProduct; } public function setIsNewProduct(?bool $isNewProduct): self { $this->isNewProduct = $isNewProduct; return $this; } /** * @return Collection|TitleCaracteristique[] */ public function getTitleCaracteristique(): Collection { return $this->titleCaracteristique; } public function addTitleCaracteristique(TitleCaracteristique $titleCaracteristique): self { if (!$this->titleCaracteristique->contains($titleCaracteristique)) { $this->titleCaracteristique[] = $titleCaracteristique; $titleCaracteristique->setProduct($this); } return $this; } public function removeTitleCaracteristique(TitleCaracteristique $titleCaracteristique): self { if ($this->titleCaracteristique->removeElement($titleCaracteristique)) { // set the owning side to null (unless already changed) if ($titleCaracteristique->getProduct() === $this) { $titleCaracteristique->setProduct(null); } } return $this; } public function getPoidsKg(): ?string { return $this->poidsKg; } public function setPoidsKg(string $poidsKg): self { $this->poidsKg = $poidsKg; return $this; } /** * @return Collection|PriceDiscount[] */ public function getPriceDiscounts(): Collection { return $this->priceDiscounts; } public function addPriceDiscount(PriceDiscount $priceDiscount): self { if (!$this->priceDiscounts->contains($priceDiscount)) { $this->priceDiscounts[] = $priceDiscount; $priceDiscount->setProduct($this); } return $this; } public function removePriceDiscount(PriceDiscount $priceDiscount): self { if ($this->priceDiscounts->removeElement($priceDiscount)) { // set the owning side to null (unless already changed) if ($priceDiscount->getProduct() === $this) { $priceDiscount->setProduct(null); } } return $this; } public function getCaracteristique(): ?string { return $this->caracteristique; } public function setCaracteristique(?string $caracteristique): self { $this->caracteristique = $caracteristique; return $this; } public function getPosition() { return $this->position; } public function setPosition($position) { $this->position = $position; return $this; } }