<?php
namespace App\Entity;
use App\Repository\ShopCategorieRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ShopCategorieRepository::class)
*/
class ShopCategorie
{
static $colorScheme = ['code' => '#677787', 'conduite-auto' => '#13889b', 'conduite-moto' => '#be2e3c', 'plateau' => '#85b200' , 'boitemanu' => '#13889b' , 'boiteauto' => '#003F7D' ];
/**
* @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\OneToMany(targetEntity=ShopProduit::class, mappedBy="categorie")
*/
private $shopProduits;
/**
* @ORM\Column(type="string", length=255)
*/
private $slug;
/**
* @ORM\OneToMany(targetEntity=UserEleveCredit::class, mappedBy="categorie")
*/
private $UserEleveCredits;
/**
* @ORM\OneToMany(targetEntity=ShopOrderProductConsommation::class, mappedBy="categorie")
*/
private $ShopOrderProductConsommations;
/**
* @ORM\OneToMany(targetEntity=ShopOrderProduct::class, mappedBy="categorie")
*/
private $shopOrderProducts;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $domaine;
/**
* @ORM\OneToMany(targetEntity=UserEleveCreditConsommation::class, mappedBy="categorie")
*/
private $userEleveCreditConsommations;
/**
* @ORM\ManyToMany(targetEntity=Livret::class, mappedBy="categorie")
*/
private $livrets;
public function __construct()
{
$this->shopProduits = new ArrayCollection();
$this->UserEleveCredits = new ArrayCollection();
$this->ShopOrderProductConsommations = new ArrayCollection();
$this->shopOrderProducts = new ArrayCollection();
$this->userEleveCreditConsommations = new ArrayCollection();
$this->livrets = 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;
}
/**
* @return Collection|ShopProduit[]
*/
public function getShopProduits(): Collection
{
return $this->shopProduits;
}
public function addShopProduit(ShopProduit $shopProduit): self
{
if (!$this->shopProduits->contains($shopProduit)) {
$this->shopProduits[] = $shopProduit;
$shopProduit->setCategorie($this);
}
return $this;
}
public function removeShopProduit(ShopProduit $shopProduit): self
{
if ($this->shopProduits->removeElement($shopProduit)) {
// set the owning side to null (unless already changed)
if ($shopProduit->getCategorie() === $this) {
$shopProduit->setCategorie(null);
}
}
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
/**
* @return Collection|UserEleveCredit[]
*/
public function getUserEleveCredits(): Collection
{
return $this->UserEleveCredits;
}
public function addUserEleveCredit(UserEleveCredit $UserEleveCredit): self
{
if (!$this->UserEleveCredits->contains($UserEleveCredit)) {
$this->UserEleveCredits[] = $UserEleveCredit;
$UserEleveCredit->setCategorie($this);
}
return $this;
}
public function removeUserEleveCredit(UserEleveCredit $UserEleveCredit): self
{
if ($this->UserEleveCredits->removeElement($UserEleveCredit)) {
// set the owning side to null (unless already changed)
if ($UserEleveCredit->getCategorie() === $this) {
$UserEleveCredit->setCategorie(null);
}
}
return $this;
}
/**
* @return Collection|ShopOrderProductConsommation[]
*/
public function getShopOrderProductConsommations(): Collection
{
return $this->ShopOrderProductConsommations;
}
public function addShopOrderProductConsommation(ShopOrderProductConsommation $ShopOrderProductConsommation): self
{
if (!$this->ShopOrderProductConsommations->contains($ShopOrderProductConsommation)) {
$this->ShopOrderProductConsommations[] = $ShopOrderProductConsommation;
$ShopOrderProductConsommation->setCategorie($this);
}
return $this;
}
public function removeShopOrderProductConsommation(ShopOrderProductConsommation $ShopOrderProductConsommation): self
{
if ($this->ShopOrderProductConsommations->removeElement($ShopOrderProductConsommation)) {
// set the owning side to null (unless already changed)
if ($ShopOrderProductConsommation->getCategorie() === $this) {
$ShopOrderProductConsommation->setCategorie(null);
}
}
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->setCategorie($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->getCategorie() === $this) {
$shopOrderProduct->setCategorie(null);
}
}
return $this;
}
public function getDomaine(): ?string
{
return $this->domaine;
}
public function setDomaine(?string $domaine): self
{
$this->domaine = $domaine;
return $this;
}
/**
* @return Collection<int, UserEleveCreditConsommation>
*/
public function getUserEleveCreditConsommations(): Collection
{
return $this->userEleveCreditConsommations;
}
public function addUserEleveCreditConsommation(UserEleveCreditConsommation $userEleveCreditConsommation): self
{
if (!$this->userEleveCreditConsommations->contains($userEleveCreditConsommation)) {
$this->userEleveCreditConsommations[] = $userEleveCreditConsommation;
$userEleveCreditConsommation->setCategorie($this);
}
return $this;
}
public function removeUserEleveCreditConsommation(UserEleveCreditConsommation $userEleveCreditConsommation): self
{
if ($this->userEleveCreditConsommations->removeElement($userEleveCreditConsommation)) {
// set the owning side to null (unless already changed)
if ($userEleveCreditConsommation->getCategorie() === $this) {
$userEleveCreditConsommation->setCategorie(null);
}
}
return $this;
}
public function getColor(): ?string
{
if (isset(self::$colorScheme[$this->getSlug()])) {
return self::$colorScheme[$this->getSlug()];
}
return null;
}
/**
* @return Collection<int, Livret>
*/
public function getLivrets(): Collection
{
return $this->livrets;
}
public function addLivret(Livret $livret): self
{
if (!$this->livrets->contains($livret)) {
$this->livrets[] = $livret;
$livret->addCategorie($this);
}
return $this;
}
public function removeLivret(Livret $livret): self
{
if ($this->livrets->removeElement($livret)) {
$livret->removeCategorie($this);
}
return $this;
}
}