src/Entity/Categories.php line 13

Open in your IDE?
  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.     public function __construct()
  36.     {
  37.         $this->parent null;
  38.         $this->status = new ArrayCollection();
  39.         $this->variables = new ArrayCollection();
  40.         $this->immeubles = new ArrayCollection();
  41.     }
  42.     public  function __toString(): string
  43.     {
  44.         return $this->getLibelle() ;
  45.     }
  46.     /**
  47.      * @return string|null
  48.      */
  49.     public function getFullLibelle(): ?string
  50.     {
  51.         return $this->fullLibelle;
  52.     }
  53.     /**
  54.      * @param string|null $fullLibelle
  55.      */
  56.     public function setFullLibelle(?string $fullLibelle): self
  57.     {
  58.         $this->fullLibelle $fullLibelle;
  59.         return $this;
  60.     }
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getLibelle(): ?string
  66.     {
  67.         return $this->libelle;
  68.     }
  69.     public function setLibelle(string $libelle): self
  70.     {
  71.         $this->libelle $libelle;
  72.         return $this;
  73.     }
  74.     public function getDescription(): ?string
  75.     {
  76.         return $this->description;
  77.     }
  78.     public function setDescription(?string $description): self
  79.     {
  80.         $this->description $description;
  81.         return $this;
  82.     }
  83.     public function getParent(): ?self
  84.     {
  85.         return $this->parent;
  86.     }
  87.     public function setParent(?self $parent): self
  88.     {
  89.         $this->parent $parent;
  90.         return $this;
  91.     }
  92.     public function addParent(self $parent): self
  93.     {
  94.         if (!$this->parent->contains($parent)) {
  95.             $this->parent[] = $parent;
  96.             $parent->setParent($this);
  97.         }
  98.         return $this;
  99.     }
  100.     public function removeParent(self $parent): self
  101.     {
  102.         if ($this->parent->removeElement($parent)) {
  103.             // set the owning side to null (unless already changed)
  104.             if ($parent->getParent() === $this) {
  105.                 $parent->setParent(null);
  106.             }
  107.         }
  108.         return $this;
  109.     }
  110.     /**
  111.      * @return Collection<int, Articles>
  112.      */
  113.     public function getArticles(): Collection
  114.     {
  115.         return $this->articles;
  116.     }
  117.     public function addArticles(Articles $articles): self
  118.     {
  119.         if (!$this->articles->contains($articles)) {
  120.             $this->articles[] = $articles;
  121.             $articles->setCategorie($this);
  122.         }
  123.         return $this;
  124.     }
  125.     public function removeStatus(Articles $articles): self
  126.     {
  127.         if ($this->articles->removeElement($articles)) {
  128.             // set the owning side to null (unless already changed)
  129.             if ($articles->getCategorie() === $this) {
  130.                 $articles->setCategorie(null);
  131.             }
  132.         }
  133.         return $this;
  134.     }
  135.     public function isIsActif(): ?bool
  136.     {
  137.         return $this->isActif;
  138.     }
  139.     public function setIsActif(?bool $isActif): self
  140.     {
  141.         $this->isActif $isActif;
  142.         return $this;
  143.     }
  144.     /**
  145.      * @return Collection<int, Variables>
  146.      */
  147.     public function getVariables(): Collection
  148.     {
  149.         return $this->variables;
  150.     }
  151.     public function addVariable(Variables $variable): self
  152.     {
  153.         if (!$this->variables->contains($variable)) {
  154.             $this->variables[] = $variable;
  155.             $variable->setCategorie($this);
  156.         }
  157.         return $this;
  158.     }
  159.     public function removeVariable(Variables $variable): self
  160.     {
  161.         if ($this->variables->removeElement($variable)) {
  162.             // set the owning side to null (unless already changed)
  163.             if ($variable->getCategorie() === $this) {
  164.                 $variable->setCategorie(null);
  165.             }
  166.         }
  167.         return $this;
  168.     }
  169.     /**
  170.      * @return Collection<int, Immeubles>
  171.      */
  172.     public function getImmeubles(): Collection
  173.     {
  174.         return $this->immeubles;
  175.     }
  176.     public function addImmeuble(Immeubles $immeuble): self
  177.     {
  178.         if (!$this->immeubles->contains($immeuble)) {
  179.             $this->immeubles[] = $immeuble;
  180.             $immeuble->setCategorie($this);
  181.         }
  182.         return $this;
  183.     }
  184.     public function removeImmeuble(Immeubles $immeuble): self
  185.     {
  186.         if ($this->immeubles->removeElement($immeuble)) {
  187.             // set the owning side to null (unless already changed)
  188.             if ($immeuble->getCategorie() === $this) {
  189.                 $immeuble->setCategorie(null);
  190.             }
  191.         }
  192.         return $this;
  193.     }
  194.     public function getIcon(): ?string
  195.     {
  196.         return $this->icon;
  197.     }
  198.     public function setIcon(?string $icon): self
  199.     {
  200.         $this->icon $icon;
  201.         return $this;
  202.     }
  203. }