src/Entity/ShopCategorie.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ShopCategorieRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ShopCategorieRepository::class)
  9.  */
  10. class ShopCategorie
  11. {
  12.     static $colorScheme = ['code' => '#677787''conduite-auto' => '#13889b''conduite-moto' => '#be2e3c''plateau' => '#85b200' 'boitemanu' => '#13889b' 'boiteauto' => '#003F7D' ];
  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\OneToMany(targetEntity=ShopProduit::class, mappedBy="categorie")
  29.      */
  30.     private $shopProduits;
  31.     /**
  32.      * @ORM\Column(type="string", length=255)
  33.      */
  34.     private $slug;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=UserEleveCredit::class, mappedBy="categorie")
  37.      */
  38.     private $UserEleveCredits;
  39.     /**
  40.      * @ORM\OneToMany(targetEntity=ShopOrderProductConsommation::class, mappedBy="categorie")
  41.      */
  42.     private $ShopOrderProductConsommations;
  43.     /**
  44.      * @ORM\OneToMany(targetEntity=ShopOrderProduct::class, mappedBy="categorie")
  45.      */
  46.     private $shopOrderProducts;
  47.     /**
  48.      * @ORM\Column(type="string", length=50, nullable=true)
  49.      */
  50.     private $domaine;
  51.     /**
  52.      * @ORM\OneToMany(targetEntity=UserEleveCreditConsommation::class, mappedBy="categorie")
  53.      */
  54.     private $userEleveCreditConsommations;
  55.     /**
  56.      * @ORM\ManyToMany(targetEntity=Livret::class, mappedBy="categorie")
  57.      */
  58.     private $livrets;
  59.     public function __construct()
  60.     {
  61.         $this->shopProduits = new ArrayCollection();
  62.         $this->UserEleveCredits = new ArrayCollection();
  63.         $this->ShopOrderProductConsommations = new ArrayCollection();
  64.         $this->shopOrderProducts = new ArrayCollection();
  65.         $this->userEleveCreditConsommations = new ArrayCollection();
  66.         $this->livrets = new ArrayCollection();
  67.     }
  68.     public function getId(): ?int
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getIntitule(): ?string
  73.     {
  74.         return $this->intitule;
  75.     }
  76.     public function setIntitule(string $intitule): self
  77.     {
  78.         $this->intitule $intitule;
  79.         return $this;
  80.     }
  81.     public function getDescriptif(): ?string
  82.     {
  83.         return $this->descriptif;
  84.     }
  85.     public function setDescriptif(string $descriptif): self
  86.     {
  87.         $this->descriptif $descriptif;
  88.         return $this;
  89.     }
  90.     /**
  91.      * @return Collection|ShopProduit[]
  92.      */
  93.     public function getShopProduits(): Collection
  94.     {
  95.         return $this->shopProduits;
  96.     }
  97.     public function addShopProduit(ShopProduit $shopProduit): self
  98.     {
  99.         if (!$this->shopProduits->contains($shopProduit)) {
  100.             $this->shopProduits[] = $shopProduit;
  101.             $shopProduit->setCategorie($this);
  102.         }
  103.         return $this;
  104.     }
  105.     public function removeShopProduit(ShopProduit $shopProduit): self
  106.     {
  107.         if ($this->shopProduits->removeElement($shopProduit)) {
  108.             // set the owning side to null (unless already changed)
  109.             if ($shopProduit->getCategorie() === $this) {
  110.                 $shopProduit->setCategorie(null);
  111.             }
  112.         }
  113.         return $this;
  114.     }
  115.     public function getSlug(): ?string
  116.     {
  117.         return $this->slug;
  118.     }
  119.     public function setSlug(string $slug): self
  120.     {
  121.         $this->slug $slug;
  122.         return $this;
  123.     }
  124.     /**
  125.      * @return Collection|UserEleveCredit[]
  126.      */
  127.     public function getUserEleveCredits(): Collection
  128.     {
  129.         return $this->UserEleveCredits;
  130.     }
  131.     public function addUserEleveCredit(UserEleveCredit $UserEleveCredit): self
  132.     {
  133.         if (!$this->UserEleveCredits->contains($UserEleveCredit)) {
  134.             $this->UserEleveCredits[] = $UserEleveCredit;
  135.             $UserEleveCredit->setCategorie($this);
  136.         }
  137.         return $this;
  138.     }
  139.     public function removeUserEleveCredit(UserEleveCredit $UserEleveCredit): self
  140.     {
  141.         if ($this->UserEleveCredits->removeElement($UserEleveCredit)) {
  142.             // set the owning side to null (unless already changed)
  143.             if ($UserEleveCredit->getCategorie() === $this) {
  144.                 $UserEleveCredit->setCategorie(null);
  145.             }
  146.         }
  147.         return $this;
  148.     }
  149.     /**
  150.      * @return Collection|ShopOrderProductConsommation[]
  151.      */
  152.     public function getShopOrderProductConsommations(): Collection
  153.     {
  154.         return $this->ShopOrderProductConsommations;
  155.     }
  156.     public function addShopOrderProductConsommation(ShopOrderProductConsommation $ShopOrderProductConsommation): self
  157.     {
  158.         if (!$this->ShopOrderProductConsommations->contains($ShopOrderProductConsommation)) {
  159.             $this->ShopOrderProductConsommations[] = $ShopOrderProductConsommation;
  160.             $ShopOrderProductConsommation->setCategorie($this);
  161.         }
  162.         return $this;
  163.     }
  164.     public function removeShopOrderProductConsommation(ShopOrderProductConsommation $ShopOrderProductConsommation): self
  165.     {
  166.         if ($this->ShopOrderProductConsommations->removeElement($ShopOrderProductConsommation)) {
  167.             // set the owning side to null (unless already changed)
  168.             if ($ShopOrderProductConsommation->getCategorie() === $this) {
  169.                 $ShopOrderProductConsommation->setCategorie(null);
  170.             }
  171.         }
  172.         return $this;
  173.     }
  174.     /**
  175.      * @return Collection|ShopOrderProduct[]
  176.      */
  177.     public function getShopOrderProducts(): Collection
  178.     {
  179.         return $this->shopOrderProducts;
  180.     }
  181.     public function addShopOrderProduct(ShopOrderProduct $shopOrderProduct): self
  182.     {
  183.         if (!$this->shopOrderProducts->contains($shopOrderProduct)) {
  184.             $this->shopOrderProducts[] = $shopOrderProduct;
  185.             $shopOrderProduct->setCategorie($this);
  186.         }
  187.         return $this;
  188.     }
  189.     public function removeShopOrderProduct(ShopOrderProduct $shopOrderProduct): self
  190.     {
  191.         if ($this->shopOrderProducts->removeElement($shopOrderProduct)) {
  192.             // set the owning side to null (unless already changed)
  193.             if ($shopOrderProduct->getCategorie() === $this) {
  194.                 $shopOrderProduct->setCategorie(null);
  195.             }
  196.         }
  197.         return $this;
  198.     }
  199.     public function getDomaine(): ?string
  200.     {
  201.         return $this->domaine;
  202.     }
  203.     public function setDomaine(?string $domaine): self
  204.     {
  205.         $this->domaine $domaine;
  206.         return $this;
  207.     }
  208.     /**
  209.      * @return Collection<int, UserEleveCreditConsommation>
  210.      */
  211.     public function getUserEleveCreditConsommations(): Collection
  212.     {
  213.         return $this->userEleveCreditConsommations;
  214.     }
  215.     public function addUserEleveCreditConsommation(UserEleveCreditConsommation $userEleveCreditConsommation): self
  216.     {
  217.         if (!$this->userEleveCreditConsommations->contains($userEleveCreditConsommation)) {
  218.             $this->userEleveCreditConsommations[] = $userEleveCreditConsommation;
  219.             $userEleveCreditConsommation->setCategorie($this);
  220.         }
  221.         return $this;
  222.     }
  223.     public function removeUserEleveCreditConsommation(UserEleveCreditConsommation $userEleveCreditConsommation): self
  224.     {
  225.         if ($this->userEleveCreditConsommations->removeElement($userEleveCreditConsommation)) {
  226.             // set the owning side to null (unless already changed)
  227.             if ($userEleveCreditConsommation->getCategorie() === $this) {
  228.                 $userEleveCreditConsommation->setCategorie(null);
  229.             }
  230.         }
  231.         return $this;
  232.     }
  233.     public function getColor(): ?string
  234.     {
  235.         if (isset(self::$colorScheme[$this->getSlug()])) {
  236.             return self::$colorScheme[$this->getSlug()];
  237.         }
  238.         return null;
  239.     }
  240.     /**
  241.      * @return Collection<int, Livret>
  242.      */
  243.     public function getLivrets(): Collection
  244.     {
  245.         return $this->livrets;
  246.     }
  247.     public function addLivret(Livret $livret): self
  248.     {
  249.         if (!$this->livrets->contains($livret)) {
  250.             $this->livrets[] = $livret;
  251.             $livret->addCategorie($this);
  252.         }
  253.         return $this;
  254.     }
  255.     public function removeLivret(Livret $livret): self
  256.     {
  257.         if ($this->livrets->removeElement($livret)) {
  258.             $livret->removeCategorie($this);
  259.         }
  260.         return $this;
  261.     }
  262. }