src/Entity/Categories.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\CodeTrait;
  4. use App\Entity\Trait\SlugTrait;
  5. use App\Repository\CategoriesRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassCategoriesRepository::class)]
  10. class Categories
  11. {
  12.     use CodeTrait ;
  13.     use SlugTrait ;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column()]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $libelle null;
  20.     #[ORM\Column(length255nullabletrue)]
  21.     private ?string $description null;
  22.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'parent')]
  23.     private ?self $parent null;
  24.     #[ORM\OneToMany(mappedBy'categorie'targetEntityArticles::class)]
  25.     private Collection $articles;
  26.     #[ORM\Column(nullabletrue)]
  27.     private ?bool $isActif null;
  28.     private ?string $fullLibelle;
  29.     #[ORM\OneToMany(mappedBy'Categorie'targetEntityVariables::class)]
  30.     private Collection $variables;
  31.     #[ORM\OneToMany(mappedBy'categorie'targetEntityImmeubles::class)]
  32.     private Collection $immeubles;
  33.     #[ORM\Column(length255nullabletrue)]
  34.     private ?string $icon null;
  35.     #[ORM\OneToMany(mappedBy'categorie'targetEntityServices::class)]
  36.     private Collection $services;
  37.     public function __construct()
  38.     {
  39.         $this->parent null;
  40.         $this->status = new ArrayCollection();
  41.         $this->variables = new ArrayCollection();
  42.         $this->immeubles = new ArrayCollection();
  43.         $this->services = new ArrayCollection();
  44.     }
  45.     public  function __toString(): string
  46.     {
  47.         return $this->getLibelle() ;
  48.     }
  49.     /**
  50.      * @return string|null
  51.      */
  52.     public function getFullLibelle(): ?string
  53.     {
  54.         return $this->fullLibelle;
  55.     }
  56.     /**
  57.      * @param string|null $fullLibelle
  58.      */
  59.     public function setFullLibelle(?string $fullLibelle): self
  60.     {
  61.         $this->fullLibelle $fullLibelle;
  62.         return $this;
  63.     }
  64.     public function getId(): ?int
  65.     {
  66.         return $this->id;
  67.     }
  68.     public function getLibelle(): ?string
  69.     {
  70.         return $this->libelle;
  71.     }
  72.     public function setLibelle(string $libelle): self
  73.     {
  74.         $this->libelle $libelle;
  75.         return $this;
  76.     }
  77.     public function getDescription(): ?string
  78.     {
  79.         return $this->description;
  80.     }
  81.     public function setDescription(?string $description): self
  82.     {
  83.         $this->description $description;
  84.         return $this;
  85.     }
  86.     public function getParent(): ?self
  87.     {
  88.         return $this->parent;
  89.     }
  90.     public function setParent(?self $parent): self
  91.     {
  92.         $this->parent $parent;
  93.         return $this;
  94.     }
  95.     public function addParent(self $parent): self
  96.     {
  97.         if (!$this->parent->contains($parent)) {
  98.             $this->parent[] = $parent;
  99.             $parent->setParent($this);
  100.         }
  101.         return $this;
  102.     }
  103.     public function removeParent(self $parent): self
  104.     {
  105.         if ($this->parent->removeElement($parent)) {
  106.             // set the owning side to null (unless already changed)
  107.             if ($parent->getParent() === $this) {
  108.                 $parent->setParent(null);
  109.             }
  110.         }
  111.         return $this;
  112.     }
  113.     /**
  114.      * @return Collection<int, Articles>
  115.      */
  116.     public function getArticles(): Collection
  117.     {
  118.         return $this->articles;
  119.     }
  120.     public function addArticles(Articles $articles): self
  121.     {
  122.         if (!$this->articles->contains($articles)) {
  123.             $this->articles[] = $articles;
  124.             $articles->setCategorie($this);
  125.         }
  126.         return $this;
  127.     }
  128.     public function removeStatus(Articles $articles): self
  129.     {
  130.         if ($this->articles->removeElement($articles)) {
  131.             // set the owning side to null (unless already changed)
  132.             if ($articles->getCategorie() === $this) {
  133.                 $articles->setCategorie(null);
  134.             }
  135.         }
  136.         return $this;
  137.     }
  138.     public function isIsActif(): ?bool
  139.     {
  140.         return $this->isActif;
  141.     }
  142.     public function setIsActif(?bool $isActif): self
  143.     {
  144.         $this->isActif $isActif;
  145.         return $this;
  146.     }
  147.     /**
  148.      * @return Collection<int, Variables>
  149.      */
  150.     public function getVariables(): Collection
  151.     {
  152.         return $this->variables;
  153.     }
  154.     public function addVariable(Variables $variable): self
  155.     {
  156.         if (!$this->variables->contains($variable)) {
  157.             $this->variables[] = $variable;
  158.             $variable->setCategorie($this);
  159.         }
  160.         return $this;
  161.     }
  162.     public function removeVariable(Variables $variable): self
  163.     {
  164.         if ($this->variables->removeElement($variable)) {
  165.             // set the owning side to null (unless already changed)
  166.             if ($variable->getCategorie() === $this) {
  167.                 $variable->setCategorie(null);
  168.             }
  169.         }
  170.         return $this;
  171.     }
  172.     /**
  173.      * @return Collection<int, Immeubles>
  174.      */
  175.     public function getImmeubles(): Collection
  176.     {
  177.         return $this->immeubles;
  178.     }
  179.     public function addImmeuble(Immeubles $immeuble): self
  180.     {
  181.         if (!$this->immeubles->contains($immeuble)) {
  182.             $this->immeubles[] = $immeuble;
  183.             $immeuble->setCategorie($this);
  184.         }
  185.         return $this;
  186.     }
  187.     public function removeImmeuble(Immeubles $immeuble): self
  188.     {
  189.         if ($this->immeubles->removeElement($immeuble)) {
  190.             // set the owning side to null (unless already changed)
  191.             if ($immeuble->getCategorie() === $this) {
  192.                 $immeuble->setCategorie(null);
  193.             }
  194.         }
  195.         return $this;
  196.     }
  197.     public function getIcon(): ?string
  198.     {
  199.         return $this->icon;
  200.     }
  201.     public function setIcon(?string $icon): self
  202.     {
  203.         $this->icon $icon;
  204.         return $this;
  205.     }
  206.     /**
  207.      * @return Collection<int, Services>
  208.      */
  209.     public function getServices(): Collection
  210.     {
  211.         return $this->services;
  212.     }
  213.     public function addService(Services $service): static
  214.     {
  215.         if (!$this->services->contains($service)) {
  216.             $this->services->add($service);
  217.             $service->setCategorie($this);
  218.         }
  219.         return $this;
  220.     }
  221.     public function removeService(Services $service): static
  222.     {
  223.         if ($this->services->removeElement($service)) {
  224.             // set the owning side to null (unless already changed)
  225.             if ($service->getCategorie() === $this) {
  226.                 $service->setCategorie(null);
  227.             }
  228.         }
  229.         return $this;
  230.     }
  231. }