src/Domain/Entity/Persona.php line 9

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 Symfony\Component\Validator\Constraints as Assert;
  6. class Persona extends Interviniente
  7. {
  8.     private ?string $dni null;
  9.     /**
  10.      * @var string|null
  11.      * @Assert\NotBlank(message="not_blank")
  12.      */
  13.     private ?string $nombre null;
  14.     /**
  15.      * @var string|null
  16.      * @Assert\NotBlank(message="not_blank")
  17.      */
  18.     private ?string $primerApellido null;
  19.     /**
  20.      * @var string|null
  21.      * @Assert\NotBlank(message="not_blank")
  22.      */
  23.     private ?string $segundoApellido null;
  24.     /**
  25.      * @var string|null
  26.      * @Assert\NotBlank(message="not_blank")
  27.      */
  28.     private ?string $representacion null;
  29.     private Collection $documentacionPersonas;
  30.     private Collection $consortiumLaborals;
  31.     private Collection $comisionesParitarias;
  32.     private Collection $empresas;
  33.     private Collection $organosRepresentacion;
  34.     public function __construct()
  35.     {
  36.         $this->documentacionPersonas = new ArrayCollection();
  37.         $this->consortiumLaborals = new ArrayCollection();
  38.         $this->comisionesParitarias = new ArrayCollection();
  39.         $this->empresas = new ArrayCollection();
  40.         $this->organosRepresentacion = new ArrayCollection();
  41.     }
  42.     public function __toString(): string
  43.     {
  44.         return $this->getNombreCompleto();
  45.     }
  46.     public function getDni(): ?string
  47.     {
  48.         return $this->dni;
  49.     }
  50.     public function setDni(?string $dni): static
  51.     {
  52.         $this->dni $dni;
  53.         return $this;
  54.     }
  55.     public function getNombre(): ?string
  56.     {
  57.         return $this->nombre;
  58.     }
  59.     public function setNombre(?string $nombre): static
  60.     {
  61.         $this->nombre $nombre;
  62.         return $this;
  63.     }
  64.     public function getPrimerApellido(): ?string
  65.     {
  66.         return $this->primerApellido;
  67.     }
  68.     public function setPrimerApellido(?string $primerApellido): static
  69.     {
  70.         $this->primerApellido $primerApellido;
  71.         return $this;
  72.     }
  73.     public function getSegundoApellido(): ?string
  74.     {
  75.         return $this->segundoApellido;
  76.     }
  77.     public function setSegundoApellido(?string $segundoApellido): static
  78.     {
  79.         $this->segundoApellido $segundoApellido;
  80.         return $this;
  81.     }
  82.     public function getRepresentacion(): ?string
  83.     {
  84.         return $this->representacion;
  85.     }
  86.     public function setRepresentacion(?string $representacion): static
  87.     {
  88.         $this->representacion $representacion;
  89.         return $this;
  90.     }
  91.     /**
  92.      * @return Collection<int, DocumentacionPersona>
  93.      */
  94.     public function getDocumentacionPersonas(): Collection
  95.     {
  96.         return $this->documentacionPersonas;
  97.     }
  98.     public function addDocumentacionPersona(DocumentacionPersona $documentacionPersona): static
  99.     {
  100.         if (!$this->documentacionPersonas->contains($documentacionPersona)) {
  101.             $this->documentacionPersonas->add($documentacionPersona);
  102.             $documentacionPersona->setPersona($this);
  103.         }
  104.         return $this;
  105.     }
  106.     public function removeDocumentacionPersona(DocumentacionPersona $documentacionPersona): static
  107.     {
  108.         if ($this->documentacionPersonas->removeElement($documentacionPersona)) {
  109.             // set the owning side to null (unless already changed)
  110.             if ($documentacionPersona->getPersona() === $this) {
  111.                 $documentacionPersona->setPersona(null);
  112.             }
  113.         }
  114.         return $this;
  115.     }
  116.     /**
  117.      * @return Collection<int, ConsortiumLaboral>
  118.      */
  119.     public function getConsortiumLaborals(): Collection
  120.     {
  121.         return $this->consortiumLaborals;
  122.     }
  123.     public function addConsortiumLaboral(ConsortiumLaboral $consortiumLaboral): static
  124.     {
  125.         if (!$this->consortiumLaborals->contains($consortiumLaboral)) {
  126.             $this->consortiumLaborals->add($consortiumLaboral);
  127.             $consortiumLaboral->setPersona($this);
  128.         }
  129.         return $this;
  130.     }
  131.     public function removeConsortiumLaboral(ConsortiumLaboral $consortiumLaboral): static
  132.     {
  133.         if ($this->consortiumLaborals->removeElement($consortiumLaboral)) {
  134.             // set the owning side to null (unless already changed)
  135.             if ($consortiumLaboral->getPersona() === $this) {
  136.                 $consortiumLaboral->setPersona(null);
  137.             }
  138.         }
  139.         return $this;
  140.     }
  141.     /**
  142.      * @return Collection<int, ComisionParitaria>
  143.      */
  144.     public function getComisionesParitarias(): Collection
  145.     {
  146.         return $this->comisionesParitarias;
  147.     }
  148.     public function addComisionesParitaria(ComisionParitaria $comisionesParitaria): static
  149.     {
  150.         if (!$this->comisionesParitarias->contains($comisionesParitaria)) {
  151.             $this->comisionesParitarias->add($comisionesParitaria);
  152.             $comisionesParitaria->addPersona($this);
  153.         }
  154.         return $this;
  155.     }
  156.     public function removeComisionesParitaria(ComisionParitaria $comisionesParitaria): static
  157.     {
  158.         if ($this->comisionesParitarias->removeElement($comisionesParitaria)) {
  159.             $comisionesParitaria->removePersona($this);
  160.         }
  161.         return $this;
  162.     }
  163.     /**
  164.      * @return Collection<int, Empresa>
  165.      */
  166.     public function getEmpresas(): Collection
  167.     {
  168.         return $this->empresas;
  169.     }
  170.     public function addEmpresa(Empresa $empresa): static
  171.     {
  172.         if (!$this->empresas->contains($empresa)) {
  173.             $this->empresas->add($empresa);
  174.             $empresa->setPersona($this);
  175.         }
  176.         return $this;
  177.     }
  178.     public function removeEmpresa(Empresa $empresa): static
  179.     {
  180.         if ($this->empresas->removeElement($empresa)) {
  181.             // set the owning side to null (unless already changed)
  182.             if ($empresa->getPersona() === $this) {
  183.                 $empresa->setPersona(null);
  184.             }
  185.         }
  186.         return $this;
  187.     }
  188.     public function getNombreCompleto(): string
  189.     {
  190.         return implode(' ', [$this->getNombre(), $this->getPrimerApellido(), $this->getSegundoApellido()])??'---';
  191.     }
  192.     /**
  193.      * @return Collection<int, OrganoRepresentacion>
  194.      */
  195.     public function getOrganosRepresentacion(): Collection
  196.     {
  197.         return $this->organosRepresentacion;
  198.     }
  199.     public function addOrganosRepresentacion(OrganoRepresentacion $organosRepresentacion): static
  200.     {
  201.         if (!$this->organosRepresentacion->contains($organosRepresentacion)) {
  202.             $this->organosRepresentacion->add($organosRepresentacion);
  203.             $organosRepresentacion->addPersonasContacto($this);
  204.         }
  205.         return $this;
  206.     }
  207.     public function removeOrganosRepresentacion(OrganoRepresentacion $organosRepresentacion): static
  208.     {
  209.         if ($this->organosRepresentacion->removeElement($organosRepresentacion)) {
  210.             $organosRepresentacion->removePersonasContacto($this);
  211.         }
  212.         return $this;
  213.     }
  214. }//class