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