<?php
namespace App\Entity;
use App\Repository\ProductRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ProductRepository::class)
*/
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=10, scale=2)
*/
private $priceHt;
/**
* @ORM\Column(type="text")
*/
private $desctription;
/**
* @ORM\Column(type="string", length=255)
*/
private $picture;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $linkspictures;
/**
* @ORM\ManyToOne(targetEntity=UserPlatform::class)
* @ORM\JoinColumn(nullable=false)
*/
private $userAdd;
/**
* @ORM\ManyToOne(targetEntity=CategoriProduct::class)
* @ORM\JoinColumn(nullable=false)
*/
private $fkcategorie;
/**
* @ORM\ManyToOne(targetEntity=SousCategorie::class)
*/
private $fksousCategorie;
/**
* @ORM\ManyToOne(targetEntity=Devise::class)
*/
private $fkdevise;
/**
* @ORM\ManyToOne(targetEntity=Shop::class)
*/
private $shop;
/**
* @ORM\OneToMany(targetEntity=PriceProduct::class, mappedBy="product")
*/
private $priceProducts;
/**
* @ORM\Column(type="integer")
*/
private $statdispo;
/**
* @ORM\Column(type="integer")
*/
private $stateval;
/**
* @ORM\Column(type="integer")
*/
private $points;
/**
* @ORM\OneToMany(targetEntity=Stock::class, mappedBy="produit")
*/
private $stocks;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $keyWord;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private ?bool $productDay = false;
public function isProductDay(): ?bool
{
return $this->productDay;
}
public function setProductDay(?bool $productDay): self
{
$this->productDay = $productDay;
return $this;
}
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private ?bool $catMode = false;
public function isCatMode(): ?bool
{
return $this->catMode;
}
public function setCatMode(?bool $catMode): self
{
$this->catMode = $catMode;
return $this;
}
public function __construct()
{
$this->priceProducts = new ArrayCollection();
$this->stocks = 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 getPriceHt(): ?string
{
return $this->priceHt;
}
public function setPriceHt(string $priceHt): self
{
$this->priceHt = $priceHt;
return $this;
}
public function getDesctription(): ?string
{
return $this->desctription;
}
public function setDesctription(string $desctription): self
{
$this->desctription = $desctription;
return $this;
}
public function getPicture(): ?string
{
return $this->picture;
}
public function setPicture(string $picture): self
{
$this->picture = $picture;
return $this;
}
public function getLinkspictures(): ?string
{
return $this->linkspictures;
}
public function getLinkspicturesArrays(): ?array
{
$typevalue = gettype(json_decode($this->linkspictures));
if(gettype(json_decode($this->linkspictures)) == "array"){
return json_decode($this->linkspictures);
} else return null;
}
public function setLinkspictures(?string $linkspictures): self
{
$this->linkspictures = $linkspictures;
return $this;
}
public function getUserAdd(): ?UserPlatform
{
return $this->userAdd;
}
public function setUserAdd(?UserPlatform $userAdd): self
{
$this->userAdd = $userAdd;
return $this;
}
public function getFkcategorie(): ?CategoriProduct
{
return $this->fkcategorie;
}
public function setFkcategorie(?CategoriProduct $fkcategorie): self
{
$this->fkcategorie = $fkcategorie;
return $this;
}
public function getFksousCategorie(): ?SousCategorie
{
return $this->fksousCategorie;
}
public function setFksousCategorie(?SousCategorie $fksousCategorie): self
{
$this->fksousCategorie = $fksousCategorie;
return $this;
}
public function getFkdevise(): ?Devise
{
return $this->fkdevise;
}
public function setFkdevise(?Devise $fkdevise): self
{
$this->fkdevise = $fkdevise;
return $this;
}
public function getShop(): ?Shop
{
return $this->shop;
}
public function setShop(?Shop $shop): self
{
$this->shop = $shop;
return $this;
}
/**
* @return Collection<int, PriceProduct>
*/
public function getPriceProducts(): Collection
{
return $this->priceProducts;
}
public function addPriceProduct(PriceProduct $priceProduct): self
{
if (!$this->priceProducts->contains($priceProduct)) {
$this->priceProducts[] = $priceProduct;
$priceProduct->setProduct($this);
}
return $this;
}
public function removePriceProduct(PriceProduct $priceProduct): self
{
if ($this->priceProducts->removeElement($priceProduct)) {
// set the owning side to null (unless already changed)
if ($priceProduct->getProduct() === $this) {
$priceProduct->setProduct(null);
}
}
return $this;
}
public function getStatdispo(): ?int
{
return $this->statdispo;
}
public function setStatdispo(int $statdispo): self
{
$this->statdispo = $statdispo;
return $this;
}
public function getStateval(): ?int
{
return $this->stateval;
}
public function setStateval(int $stateval): self
{
$this->stateval = $stateval;
return $this;
}
public function getPoints(): ?int
{
return $this->points;
}
public function setPoints(int $points): self
{
$this->points = $points;
return $this;
}
/**
* @return Collection<int, Stock>
*/
public function getStocks(): Collection
{
return $this->stocks;
}
public function addStock(Stock $stock): self
{
if (!$this->stocks->contains($stock)) {
$this->stocks[] = $stock;
$stock->setProduit($this);
}
return $this;
}
public function removeStock(Stock $stock): self
{
if ($this->stocks->removeElement($stock)) {
// set the owning side to null (unless already changed)
if ($stock->getProduit() === $this) {
$stock->setProduit(null);
}
}
return $this;
}
public function getKeyWord(): ?string
{
return $this->keyWord;
}
public function setKeyWord(?string $keyWord): self
{
$this->keyWord = $keyWord;
return $this;
}
}