src/Domain/Entity/Cnae.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Domain\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Uid\Uuid;
  8. class Cnae
  9. {
  10.     private ?string $codigo null;
  11.     private ?string $nombre null;
  12.     private ?int $nivel null;
  13.     private ?bool $active null;
  14.     private ?Uuid $id null;
  15.     private Collection $hijos;
  16.     private Collection $historicoCnaeAntiguas;
  17.     private Collection $historicoCnaeNuevas;
  18.     private ?self $padre null;
  19.     private ?\DateTimeInterface $createdAt null;
  20.     private ?\DateTimeInterface $updatedAt null;
  21.     private ?\DateTimeInterface $deletedAt null;
  22.     private Collection $empresas;
  23.     private Collection $sectores;
  24.     public function __construct()
  25.     {
  26.         $this->hijos = new ArrayCollection();
  27.         $this->historicoCnaeAntiguas = new ArrayCollection();
  28.         $this->historicoCnaeNuevas = new ArrayCollection();
  29.         $this->empresas = new ArrayCollection();
  30.         $this->sectores = new ArrayCollection();
  31.     }
  32.     public function __toString(): string
  33.     {
  34.         return implode(' - ', [$this->getCodigo(), $this->getNombre()])??'CNAE Sin Definir';
  35.     }
  36.     public function getCodigo(): ?string
  37.     {
  38.         return $this->codigo;
  39.     }
  40.     public function setCodigo(?string $codigo): static
  41.     {
  42.         $this->codigo $codigo;
  43.         return $this;
  44.     }
  45.     public function getNombre(): ?string
  46.     {
  47.         return $this->nombre;
  48.     }
  49.     public function setNombre(?string $nombre): static
  50.     {
  51.         $this->nombre $nombre;
  52.         return $this;
  53.     }
  54.     public function getNivel(): ?int
  55.     {
  56.         return $this->nivel;
  57.     }
  58.     public function setNivel(?int $nivel): static
  59.     {
  60.         $this->nivel $nivel;
  61.         return $this;
  62.     }
  63.     public function isActive(): ?bool
  64.     {
  65.         return $this->active;
  66.     }
  67.     public function setActive(?bool $active): static
  68.     {
  69.         $this->active $active;
  70.         return $this;
  71.     }
  72.     public function getId(): ?Uuid
  73.     {
  74.         return $this->id;
  75.     }
  76.     /**
  77.      * @return Collection<int, Cnae>
  78.      */
  79.     public function getHijos(): Collection
  80.     {
  81.         return $this->hijos;
  82.     }
  83.     public function addHijo(self $hijo): static
  84.     {
  85.         if (!$this->hijos->contains($hijo)) {
  86.             $this->hijos->add($hijo);
  87.             $hijo->setPadre($this);
  88.         }
  89.         return $this;
  90.     }
  91.     public function removeHijo(self $hijo): static
  92.     {
  93.         if ($this->hijos->removeElement($hijo)) {
  94.             // set the owning side to null (unless already changed)
  95.             if ($hijo->getPadre() === $this) {
  96.                 $hijo->setPadre(null);
  97.             }
  98.         }
  99.         return $this;
  100.     }
  101.     /**
  102.      * @return Collection<int, HistoricoCnae>
  103.      */
  104.     public function getHistoricoCnaeAntiguas(): Collection
  105.     {
  106.         return $this->historicoCnaeAntiguas;
  107.     }
  108.     public function addHistoricoCnaeAntigua(HistoricoCnae $historicoCnaeAntigua): static
  109.     {
  110.         if (!$this->historicoCnaeAntiguas->contains($historicoCnaeAntigua)) {
  111.             $this->historicoCnaeAntiguas->add($historicoCnaeAntigua);
  112.             $historicoCnaeAntigua->setCnaeAntigua($this);
  113.         }
  114.         return $this;
  115.     }
  116.     public function removeHistoricoCnaeAntigua(HistoricoCnae $historicoCnaeAntigua): static
  117.     {
  118.         if ($this->historicoCnaeAntiguas->removeElement($historicoCnaeAntigua)) {
  119.             // set the owning side to null (unless already changed)
  120.             if ($historicoCnaeAntigua->getCnaeAntigua() === $this) {
  121.                 $historicoCnaeAntigua->setCnaeAntigua(null);
  122.             }
  123.         }
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return Collection<int, HistoricoCnae>
  128.      */
  129.     public function getHistoricoCnaeNuevas(): Collection
  130.     {
  131.         return $this->historicoCnaeNuevas;
  132.     }
  133.     public function addHistoricoCnaeNueva(HistoricoCnae $historicoCnaeNueva): static
  134.     {
  135.         if (!$this->historicoCnaeNuevas->contains($historicoCnaeNueva)) {
  136.             $this->historicoCnaeNuevas->add($historicoCnaeNueva);
  137.             $historicoCnaeNueva->setCnaeNueva($this);
  138.         }
  139.         return $this;
  140.     }
  141.     public function removeHistoricoCnaeNueva(HistoricoCnae $historicoCnaeNueva): static
  142.     {
  143.         if ($this->historicoCnaeNuevas->removeElement($historicoCnaeNueva)) {
  144.             // set the owning side to null (unless already changed)
  145.             if ($historicoCnaeNueva->getCnaeNueva() === $this) {
  146.                 $historicoCnaeNueva->setCnaeNueva(null);
  147.             }
  148.         }
  149.         return $this;
  150.     }
  151.     public function getPadre(): ?self
  152.     {
  153.         return $this->padre;
  154.     }
  155.     public function setPadre(?self $padre): static
  156.     {
  157.         $this->padre $padre;
  158.         return $this;
  159.     }
  160.     public function getCreatedAt(): ?\DateTimeInterface
  161.     {
  162.         return $this->createdAt;
  163.     }
  164.     public function setCreatedAt(\DateTimeInterface $createdAt): static
  165.     {
  166.         $this->createdAt $createdAt;
  167.         return $this;
  168.     }
  169.     public function getUpdatedAt(): ?\DateTimeInterface
  170.     {
  171.         return $this->updatedAt;
  172.     }
  173.     public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  174.     {
  175.         $this->updatedAt $updatedAt;
  176.         return $this;
  177.     }
  178.     public function getDeletedAt(): ?\DateTimeInterface
  179.     {
  180.         return $this->deletedAt;
  181.     }
  182.     public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  183.     {
  184.         $this->deletedAt $deletedAt;
  185.         return $this;
  186.     }
  187.     /**
  188.      * @return Collection<int, Empresa>
  189.      */
  190.     public function getEmpresas(): Collection
  191.     {
  192.         return $this->empresas;
  193.     }
  194.     public function addEmpresa(Empresa $empresa): static
  195.     {
  196.         if (!$this->empresas->contains($empresa)) {
  197.             $this->empresas->add($empresa);
  198.             $empresa->setCnae($this);
  199.         }
  200.         return $this;
  201.     }
  202.     public function removeEmpresa(Empresa $empresa): static
  203.     {
  204.         if ($this->empresas->removeElement($empresa)) {
  205.             // set the owning side to null (unless already changed)
  206.             if ($empresa->getCnae() === $this) {
  207.                 $empresa->setCnae(null);
  208.             }
  209.         }
  210.         return $this;
  211.     }
  212.     /**
  213.      * @return Collection<int, Sector>
  214.      */
  215.     public function getSectores(): Collection
  216.     {
  217.         return $this->sectores;
  218.     }
  219.     public function addSectore(Sector $sectore): static
  220.     {
  221.         if (!$this->sectores->contains($sectore)) {
  222.             $this->sectores->add($sectore);
  223.             $sectore->setCnae($this);
  224.         }
  225.         return $this;
  226.     }
  227.     public function removeSectore(Sector $sectore): static
  228.     {
  229.         if ($this->sectores->removeElement($sectore)) {
  230.             // set the owning side to null (unless already changed)
  231.             if ($sectore->getCnae() === $this) {
  232.                 $sectore->setCnae(null);
  233.             }
  234.         }
  235.         return $this;
  236.     }
  237. }