<?phpnamespace App\Domain\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Uid\Uuid;class Cnae{ private ?string $codigo = null; private ?string $nombre = null; private ?int $nivel = null; private ?bool $active = null; private ?Uuid $id = null; private Collection $hijos; private Collection $historicoCnaeAntiguas; private Collection $historicoCnaeNuevas; private ?self $padre = null; private ?\DateTimeInterface $createdAt = null; private ?\DateTimeInterface $updatedAt = null; private ?\DateTimeInterface $deletedAt = null; private Collection $empresas; private Collection $sectores; public function __construct() { $this->hijos = new ArrayCollection(); $this->historicoCnaeAntiguas = new ArrayCollection(); $this->historicoCnaeNuevas = new ArrayCollection(); $this->empresas = new ArrayCollection(); $this->sectores = new ArrayCollection(); } public function __toString(): string { return implode(' - ', [$this->getCodigo(), $this->getNombre()])??'CNAE Sin Definir'; } public function getCodigo(): ?string { return $this->codigo; } public function setCodigo(?string $codigo): static { $this->codigo = $codigo; return $this; } public function getNombre(): ?string { return $this->nombre; } public function setNombre(?string $nombre): static { $this->nombre = $nombre; return $this; } public function getNivel(): ?int { return $this->nivel; } public function setNivel(?int $nivel): static { $this->nivel = $nivel; return $this; } public function isActive(): ?bool { return $this->active; } public function setActive(?bool $active): static { $this->active = $active; return $this; } public function getId(): ?Uuid { return $this->id; } /** * @return Collection<int, Cnae> */ public function getHijos(): Collection { return $this->hijos; } public function addHijo(self $hijo): static { if (!$this->hijos->contains($hijo)) { $this->hijos->add($hijo); $hijo->setPadre($this); } return $this; } public function removeHijo(self $hijo): static { if ($this->hijos->removeElement($hijo)) { // set the owning side to null (unless already changed) if ($hijo->getPadre() === $this) { $hijo->setPadre(null); } } return $this; } /** * @return Collection<int, HistoricoCnae> */ public function getHistoricoCnaeAntiguas(): Collection { return $this->historicoCnaeAntiguas; } public function addHistoricoCnaeAntigua(HistoricoCnae $historicoCnaeAntigua): static { if (!$this->historicoCnaeAntiguas->contains($historicoCnaeAntigua)) { $this->historicoCnaeAntiguas->add($historicoCnaeAntigua); $historicoCnaeAntigua->setCnaeAntigua($this); } return $this; } public function removeHistoricoCnaeAntigua(HistoricoCnae $historicoCnaeAntigua): static { if ($this->historicoCnaeAntiguas->removeElement($historicoCnaeAntigua)) { // set the owning side to null (unless already changed) if ($historicoCnaeAntigua->getCnaeAntigua() === $this) { $historicoCnaeAntigua->setCnaeAntigua(null); } } return $this; } /** * @return Collection<int, HistoricoCnae> */ public function getHistoricoCnaeNuevas(): Collection { return $this->historicoCnaeNuevas; } public function addHistoricoCnaeNueva(HistoricoCnae $historicoCnaeNueva): static { if (!$this->historicoCnaeNuevas->contains($historicoCnaeNueva)) { $this->historicoCnaeNuevas->add($historicoCnaeNueva); $historicoCnaeNueva->setCnaeNueva($this); } return $this; } public function removeHistoricoCnaeNueva(HistoricoCnae $historicoCnaeNueva): static { if ($this->historicoCnaeNuevas->removeElement($historicoCnaeNueva)) { // set the owning side to null (unless already changed) if ($historicoCnaeNueva->getCnaeNueva() === $this) { $historicoCnaeNueva->setCnaeNueva(null); } } return $this; } public function getPadre(): ?self { return $this->padre; } public function setPadre(?self $padre): static { $this->padre = $padre; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): static { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(\DateTimeInterface $updatedAt): static { $this->updatedAt = $updatedAt; return $this; } public function getDeletedAt(): ?\DateTimeInterface { return $this->deletedAt; } public function setDeletedAt(?\DateTimeInterface $deletedAt): static { $this->deletedAt = $deletedAt; return $this; } /** * @return Collection<int, Empresa> */ public function getEmpresas(): Collection { return $this->empresas; } public function addEmpresa(Empresa $empresa): static { if (!$this->empresas->contains($empresa)) { $this->empresas->add($empresa); $empresa->setCnae($this); } return $this; } public function removeEmpresa(Empresa $empresa): static { if ($this->empresas->removeElement($empresa)) { // set the owning side to null (unless already changed) if ($empresa->getCnae() === $this) { $empresa->setCnae(null); } } return $this; } /** * @return Collection<int, Sector> */ public function getSectores(): Collection { return $this->sectores; } public function addSectore(Sector $sectore): static { if (!$this->sectores->contains($sectore)) { $this->sectores->add($sectore); $sectore->setCnae($this); } return $this; } public function removeSectore(Sector $sectore): static { if ($this->sectores->removeElement($sectore)) { // set the owning side to null (unless already changed) if ($sectore->getCnae() === $this) { $sectore->setCnae(null); } } return $this; }}