src/Domain/Entity/Persona.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Domain\Entity;
  3. use App\Shared\Domain\Validator as CRLAssert;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * @UniqueEntity(fields={"entidad", "dni"})
  10.  */
  11. class Persona extends Interviniente
  12. {
  13.     /**
  14.      * @var string|null
  15.      * @Assert\Length( max=9, maxMessage="max_length {{ limit }}")
  16.      * @CRLAssert\ConstraintIdentidad()
  17.      * @Assert\NotBlank(message="not_blank")
  18.      */
  19.     private ?string $dni;
  20.     /**
  21.      * @var string|null
  22.      * @Assert\NotBlank(message="not_blank")
  23.      */
  24.     private ?string $nombre null;
  25.     /**
  26.      * @var string|null
  27.      * @Assert\NotBlank(message="not_blank")
  28.      */
  29.     private ?string $primerApellido null;
  30.     /**
  31.      * @var string|null
  32.      * @Assert\NotBlank(message="not_blank")
  33.      */
  34.     private ?string $segundoApellido null;
  35.     /**
  36.      * @var string|null
  37.      * @Assert\NotBlank(message="not_blank")
  38.      */
  39.     protected ?string $telefono null;
  40.     /**
  41.      * @var string|null
  42.      * @Assert\NotBlank(message="not_blank")
  43.      */
  44.     protected ?string $direccion null;
  45.     private ?string $responsabilidad null;
  46.     /**
  47.      * @var string|null
  48.      * @deprecated actualmente no se está utilizando en los maestros
  49.      */
  50.     private ?string $representacion null;
  51.     private ?Sede $sedeResponsable null;
  52.     private Collection $documentacionPersonas;
  53.     private Collection $consortiumLaborals;
  54.     private Collection $comisionesParitarias;
  55.     private Collection $empresas;
  56.     private Collection $organosRepresentacion;
  57.     private Collection $representacions;
  58.     private $consortiumLaboralss;
  59.     private $sectors;
  60.     public function __construct()
  61.     {
  62.         parent::__construct();
  63.         $this->documentacionPersonas = new ArrayCollection();
  64.         $this->consortiumLaborals = new ArrayCollection();
  65.         $this->comisionesParitarias = new ArrayCollection();
  66.         $this->empresas = new ArrayCollection();
  67.         $this->organosRepresentacion = new ArrayCollection();
  68.         $this->representacions = new ArrayCollection();
  69.         $this->consortiumLaboralss = new ArrayCollection();
  70.         $this->sectors = new ArrayCollection();
  71.     }
  72.     public function __toString(): string
  73.     {
  74.         return $this->getNombreCompleto();
  75.     }
  76.     public function getDni(): ?string
  77.     {
  78.         return $this->dni;
  79.     }
  80.     public function setDni(?string $dni): static
  81.     {
  82.         $this->dni $dni;
  83.         return $this;
  84.     }
  85.     public function getNombre(): ?string
  86.     {
  87.         return $this->nombre;
  88.     }
  89.     public function setNombre(?string $nombre): static
  90.     {
  91.         $this->nombre $nombre;
  92.         return $this;
  93.     }
  94.     public function getPrimerApellido(): ?string
  95.     {
  96.         return $this->primerApellido;
  97.     }
  98.     public function setPrimerApellido(?string $primerApellido): static
  99.     {
  100.         $this->primerApellido $primerApellido;
  101.         return $this;
  102.     }
  103.     public function getSegundoApellido(): ?string
  104.     {
  105.         return $this->segundoApellido;
  106.     }
  107.     public function setSegundoApellido(?string $segundoApellido): static
  108.     {
  109.         $this->segundoApellido $segundoApellido;
  110.         return $this;
  111.     }
  112.     /**
  113.      * @deprecated ¿actualmente se utiliza?
  114.      * @return string|null
  115.      */
  116.     public function getRepresentacion(): ?string
  117.     {
  118.         return $this->representacion;
  119.     }
  120.     /**
  121.      * @deprecated ¿actualmente se utiliza?
  122.      * @param string|null $representacion
  123.      * @return $this
  124.      */
  125.     public function setRepresentacion(?string $representacion): static
  126.     {
  127.         $this->representacion $representacion;
  128.         return $this;
  129.     }
  130.     /**
  131.      * @return Collection<int, DocumentacionPersona>
  132.      */
  133.     public function getDocumentacionPersonas(): Collection
  134.     {
  135.         return $this->documentacionPersonas;
  136.     }
  137.     public function addDocumentacionPersona(DocumentacionPersona $documentacionPersona): static
  138.     {
  139.         if (!$this->documentacionPersonas->contains($documentacionPersona)) {
  140.             $this->documentacionPersonas->add($documentacionPersona);
  141.             $documentacionPersona->setPersona($this);
  142.         }
  143.         return $this;
  144.     }
  145.     public function removeDocumentacionPersona(DocumentacionPersona $documentacionPersona): static
  146.     {
  147.         if ($this->documentacionPersonas->removeElement($documentacionPersona)) {
  148.             // set the owning side to null (unless already changed)
  149.             if ($documentacionPersona->getPersona() === $this) {
  150.                 $documentacionPersona->setPersona(null);
  151.             }
  152.         }
  153.         return $this;
  154.     }
  155.     /**
  156.      * @return Collection<int, ConsortiumLaboral>
  157.      */
  158.     public function getConsortiumLaborals(): Collection
  159.     {
  160.         return $this->consortiumLaborals;
  161.     }
  162.     public function addConsortiumLaboral(ConsortiumLaboral $consortiumLaboral): static
  163.     {
  164.         if (!$this->consortiumLaborals->contains($consortiumLaboral)) {
  165.             $this->consortiumLaborals->add($consortiumLaboral);
  166.             $consortiumLaboral->setPersona($this);
  167.         }
  168.         return $this;
  169.     }
  170.     public function removeConsortiumLaboral(ConsortiumLaboral $consortiumLaboral): static
  171.     {
  172.         if ($this->consortiumLaborals->removeElement($consortiumLaboral)) {
  173.             // set the owning side to null (unless already changed)
  174.             if ($consortiumLaboral->getPersona() === $this) {
  175.                 $consortiumLaboral->setPersona(null);
  176.             }
  177.         }
  178.         return $this;
  179.     }
  180.     /**
  181.      * @return Collection<int, ComisionParitaria>
  182.      */
  183.     public function getComisionesParitarias(): Collection
  184.     {
  185.         return $this->comisionesParitarias;
  186.     }
  187.     public function addComisionesParitaria(ComisionParitaria $comisionesParitaria): static
  188.     {
  189.         if (!$this->comisionesParitarias->contains($comisionesParitaria)) {
  190.             $this->comisionesParitarias->add($comisionesParitaria);
  191.             $comisionesParitaria->addPersona($this);
  192.         }
  193.         return $this;
  194.     }
  195.     public function removeComisionesParitaria(ComisionParitaria $comisionesParitaria): static
  196.     {
  197.         if ($this->comisionesParitarias->removeElement($comisionesParitaria)) {
  198.             $comisionesParitaria->removePersona($this);
  199.         }
  200.         return $this;
  201.     }
  202.     /**
  203.      * @return Collection<int, Empresa>
  204.      */
  205.     public function getEmpresas(): Collection
  206.     {
  207.         return $this->empresas;
  208.     }
  209.     public function addEmpresa(Empresa $empresa): static
  210.     {
  211.         if (!$this->empresas->contains($empresa)) {
  212.             $this->empresas->add($empresa);
  213.             $empresa->setPersona($this);
  214.         }
  215.         return $this;
  216.     }
  217.     public function removeEmpresa(Empresa $empresa): static
  218.     {
  219.         if ($this->empresas->removeElement($empresa)) {
  220.             // set the owning side to null (unless already changed)
  221.             if ($empresa->getPersona() === $this) {
  222.                 $empresa->setPersona(null);
  223.             }
  224.         }
  225.         return $this;
  226.     }
  227.     public function getNombreCompleto(): string
  228.     {
  229.         return implode(' ', [$this->getNombre(), $this->getPrimerApellido(), $this->getSegundoApellido()])??'---';
  230.     }
  231.     /**
  232.      * @return Collection<int, OrganoRepresentacion>
  233.      */
  234.     public function getOrganosRepresentacion(): Collection
  235.     {
  236.         return $this->organosRepresentacion;
  237.     }
  238.     public function addOrganosRepresentacion(OrganoRepresentacion $organosRepresentacion): static
  239.     {
  240.         if (!$this->organosRepresentacion->contains($organosRepresentacion)) {
  241.             $this->organosRepresentacion->add($organosRepresentacion);
  242.             $organosRepresentacion->addPersonasContacto($this);
  243.         }
  244.         return $this;
  245.     }
  246.     public function removeOrganosRepresentacion(OrganoRepresentacion $organosRepresentacion): static
  247.     {
  248.         if ($this->organosRepresentacion->removeElement($organosRepresentacion)) {
  249.             $organosRepresentacion->removePersonasContacto($this);
  250.         }
  251.         return $this;
  252.     }
  253.     /**
  254.      * @return Collection<int, Representacion>
  255.      */
  256.     public function getRepresentacions(): Collection
  257.     {
  258.         return $this->representacions;
  259.     }
  260.     public function addRepresentacion(Representacion $representacion): static
  261.     {
  262.         if (!$this->representacions->contains($representacion)) {
  263.             $this->representacions->add($representacion);
  264.             $representacion->setRepresentante($this);
  265.         }
  266.         return $this;
  267.     }
  268.     public function removeRepresentacion(Representacion $representacion): static
  269.     {
  270.         if ($this->representacions->removeElement($representacion)) {
  271.             // set the owning side to null (unless already changed)
  272.             if ($representacion->getRepresentante() === $this) {
  273.                 $representacion->setRepresentante(null);
  274.             }
  275.         }
  276.         return $this;
  277.     }
  278.     public function getResponsabilidad(): ?string
  279.     {
  280.         return $this->responsabilidad;
  281.     }
  282.     public function setResponsabilidad(?string $responsabilidad): static
  283.     {
  284.         $this->responsabilidad $responsabilidad;
  285.         return $this;
  286.     }
  287.     public function getSedeResponsable(): ?Sede
  288.     {
  289.         return $this->sedeResponsable;
  290.     }
  291.     public function setSedeResponsable(?Sede $sedeResponsable): static
  292.     {
  293.         // unset the owning side of the relation if necessary
  294.         if ($sedeResponsable === null && $this->sedeResponsable !== null) {
  295.             $this->sedeResponsable->setResponsable(null);
  296.         }
  297.         // set the owning side of the relation if necessary
  298.         if ($sedeResponsable !== null && $sedeResponsable->getResponsable() !== $this) {
  299.             $sedeResponsable->setResponsable($this);
  300.         }
  301.         $this->sedeResponsable $sedeResponsable;
  302.         return $this;
  303.     }
  304.     /**
  305.      * @return Collection<int, ConsortiumLaboral>
  306.      */
  307.     public function getConsortiumLaboralss(): Collection
  308.     {
  309.         return $this->consortiumLaboralss;
  310.     }
  311.     public function addConsortiumLaboralss(ConsortiumLaboral $consortiumLaboralss): static
  312.     {
  313.         if (!$this->consortiumLaboralss->contains($consortiumLaboralss)) {
  314.             $this->consortiumLaboralss->add($consortiumLaboralss);
  315.             $consortiumLaboralss->addPersona($this);
  316.         }
  317.         return $this;
  318.     }
  319.     public function removeConsortiumLaboralss(ConsortiumLaboral $consortiumLaboralss): static
  320.     {
  321.         if ($this->consortiumLaboralss->removeElement($consortiumLaboralss)) {
  322.             $consortiumLaboralss->removePersona($this);
  323.         }
  324.         return $this;
  325.     }
  326.     /**
  327.      * @return Collection<int, Sector>
  328.      */
  329.     public function getSectors(): Collection
  330.     {
  331.         return $this->sectors;
  332.     }
  333.     public function addSector(Sector $sector): static
  334.     {
  335.         if (!$this->sectors->contains($sector)) {
  336.             $this->sectors->add($sector);
  337.             $sector->addPersona($this);
  338.         }
  339.         return $this;
  340.     }
  341.     public function removeSector(Sector $sector): static
  342.     {
  343.         if ($this->sectors->removeElement($sector)) {
  344.             $sector->removePersona($this);
  345.         }
  346.         return $this;
  347.     }
  348. }//class