<?php
namespace App\Entity;
use App\Entity\Trait\CodeTrait;
use App\Entity\Trait\SlugTrait;
use App\Repository\CategoriesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CategoriesRepository::class)]
class Categories
{
use CodeTrait ;
use SlugTrait ;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column()]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $libelle = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $description = null;
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'parent')]
private ?self $parent = null;
#[ORM\OneToMany(mappedBy: 'categorie', targetEntity: Articles::class)]
private Collection $articles;
#[ORM\Column(nullable: true)]
private ?bool $isActif = null;
private ?string $fullLibelle;
#[ORM\OneToMany(mappedBy: 'Categorie', targetEntity: Variables::class)]
private Collection $variables;
#[ORM\OneToMany(mappedBy: 'categorie', targetEntity: Immeubles::class)]
private Collection $immeubles;
#[ORM\Column(length: 255, nullable: true)]
private ?string $icon = null;
public function __construct()
{
$this->parent = null;
$this->status = new ArrayCollection();
$this->variables = new ArrayCollection();
$this->immeubles = new ArrayCollection();
}
public function __toString(): string
{
return $this->getLibelle() ;
}
/**
* @return string|null
*/
public function getFullLibelle(): ?string
{
return $this->fullLibelle;
}
/**
* @param string|null $fullLibelle
*/
public function setFullLibelle(?string $fullLibelle): self
{
$this->fullLibelle = $fullLibelle;
return $this;
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setLibelle(string $libelle): self
{
$this->libelle = $libelle;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getParent(): ?self
{
return $this->parent;
}
public function setParent(?self $parent): self
{
$this->parent = $parent;
return $this;
}
public function addParent(self $parent): self
{
if (!$this->parent->contains($parent)) {
$this->parent[] = $parent;
$parent->setParent($this);
}
return $this;
}
public function removeParent(self $parent): self
{
if ($this->parent->removeElement($parent)) {
// set the owning side to null (unless already changed)
if ($parent->getParent() === $this) {
$parent->setParent(null);
}
}
return $this;
}
/**
* @return Collection<int, Articles>
*/
public function getArticles(): Collection
{
return $this->articles;
}
public function addArticles(Articles $articles): self
{
if (!$this->articles->contains($articles)) {
$this->articles[] = $articles;
$articles->setCategorie($this);
}
return $this;
}
public function removeStatus(Articles $articles): self
{
if ($this->articles->removeElement($articles)) {
// set the owning side to null (unless already changed)
if ($articles->getCategorie() === $this) {
$articles->setCategorie(null);
}
}
return $this;
}
public function isIsActif(): ?bool
{
return $this->isActif;
}
public function setIsActif(?bool $isActif): self
{
$this->isActif = $isActif;
return $this;
}
/**
* @return Collection<int, Variables>
*/
public function getVariables(): Collection
{
return $this->variables;
}
public function addVariable(Variables $variable): self
{
if (!$this->variables->contains($variable)) {
$this->variables[] = $variable;
$variable->setCategorie($this);
}
return $this;
}
public function removeVariable(Variables $variable): self
{
if ($this->variables->removeElement($variable)) {
// set the owning side to null (unless already changed)
if ($variable->getCategorie() === $this) {
$variable->setCategorie(null);
}
}
return $this;
}
/**
* @return Collection<int, Immeubles>
*/
public function getImmeubles(): Collection
{
return $this->immeubles;
}
public function addImmeuble(Immeubles $immeuble): self
{
if (!$this->immeubles->contains($immeuble)) {
$this->immeubles[] = $immeuble;
$immeuble->setCategorie($this);
}
return $this;
}
public function removeImmeuble(Immeubles $immeuble): self
{
if ($this->immeubles->removeElement($immeuble)) {
// set the owning side to null (unless already changed)
if ($immeuble->getCategorie() === $this) {
$immeuble->setCategorie(null);
}
}
return $this;
}
public function getIcon(): ?string
{
return $this->icon;
}
public function setIcon(?string $icon): self
{
$this->icon = $icon;
return $this;
}
}