<?php
namespace App\Domain\Entity;
use App\Shared\Domain\Validator as CRLAssert;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @UniqueEntity(fields={"entidad", "dni"})
*/
class Persona extends Interviniente
{
/**
* @var string|null
* @Assert\Length( max=9, maxMessage="max_length {{ limit }}")
* @CRLAssert\ConstraintIdentidad()
* @Assert\NotBlank(message="not_blank")
*/
private ?string $dni;
/**
* @var string|null
* @Assert\NotBlank(message="not_blank")
*/
private ?string $nombre = null;
/**
* @var string|null
* @Assert\NotBlank(message="not_blank")
*/
private ?string $primerApellido = null;
/**
* @var string|null
* @Assert\NotBlank(message="not_blank")
*/
private ?string $segundoApellido = null;
/**
* @var string|null
* @Assert\NotBlank(message="not_blank")
*/
protected ?string $telefono = null;
/**
* @var string|null
* @Assert\NotBlank(message="not_blank")
*/
protected ?string $direccion = null;
private ?string $responsabilidad = null;
/**
* @var string|null
* @deprecated actualmente no se está utilizando en los maestros
*/
private ?string $representacion = null;
private ?Sede $sedeResponsable = null;
private Collection $documentacionPersonas;
private Collection $consortiumLaborals;
private Collection $comisionesParitarias;
private Collection $empresas;
private Collection $organosRepresentacion;
private Collection $representacions;
private $consortiumLaboralss;
private $sectors;
public function __construct()
{
parent::__construct();
$this->documentacionPersonas = new ArrayCollection();
$this->consortiumLaborals = new ArrayCollection();
$this->comisionesParitarias = new ArrayCollection();
$this->empresas = new ArrayCollection();
$this->organosRepresentacion = new ArrayCollection();
$this->representacions = new ArrayCollection();
$this->consortiumLaboralss = new ArrayCollection();
$this->sectors = new ArrayCollection();
}
public function __toString(): string
{
return $this->getNombreCompleto();
}
public function getDni(): ?string
{
return $this->dni;
}
public function setDni(?string $dni): static
{
$this->dni = $dni;
return $this;
}
public function getNombre(): ?string
{
return $this->nombre;
}
public function setNombre(?string $nombre): static
{
$this->nombre = $nombre;
return $this;
}
public function getPrimerApellido(): ?string
{
return $this->primerApellido;
}
public function setPrimerApellido(?string $primerApellido): static
{
$this->primerApellido = $primerApellido;
return $this;
}
public function getSegundoApellido(): ?string
{
return $this->segundoApellido;
}
public function setSegundoApellido(?string $segundoApellido): static
{
$this->segundoApellido = $segundoApellido;
return $this;
}
/**
* @deprecated ¿actualmente se utiliza?
* @return string|null
*/
public function getRepresentacion(): ?string
{
return $this->representacion;
}
/**
* @deprecated ¿actualmente se utiliza?
* @param string|null $representacion
* @return $this
*/
public function setRepresentacion(?string $representacion): static
{
$this->representacion = $representacion;
return $this;
}
/**
* @return Collection<int, DocumentacionPersona>
*/
public function getDocumentacionPersonas(): Collection
{
return $this->documentacionPersonas;
}
public function addDocumentacionPersona(DocumentacionPersona $documentacionPersona): static
{
if (!$this->documentacionPersonas->contains($documentacionPersona)) {
$this->documentacionPersonas->add($documentacionPersona);
$documentacionPersona->setPersona($this);
}
return $this;
}
public function removeDocumentacionPersona(DocumentacionPersona $documentacionPersona): static
{
if ($this->documentacionPersonas->removeElement($documentacionPersona)) {
// set the owning side to null (unless already changed)
if ($documentacionPersona->getPersona() === $this) {
$documentacionPersona->setPersona(null);
}
}
return $this;
}
/**
* @return Collection<int, ConsortiumLaboral>
*/
public function getConsortiumLaborals(): Collection
{
return $this->consortiumLaborals;
}
public function addConsortiumLaboral(ConsortiumLaboral $consortiumLaboral): static
{
if (!$this->consortiumLaborals->contains($consortiumLaboral)) {
$this->consortiumLaborals->add($consortiumLaboral);
$consortiumLaboral->setPersona($this);
}
return $this;
}
public function removeConsortiumLaboral(ConsortiumLaboral $consortiumLaboral): static
{
if ($this->consortiumLaborals->removeElement($consortiumLaboral)) {
// set the owning side to null (unless already changed)
if ($consortiumLaboral->getPersona() === $this) {
$consortiumLaboral->setPersona(null);
}
}
return $this;
}
/**
* @return Collection<int, ComisionParitaria>
*/
public function getComisionesParitarias(): Collection
{
return $this->comisionesParitarias;
}
public function addComisionesParitaria(ComisionParitaria $comisionesParitaria): static
{
if (!$this->comisionesParitarias->contains($comisionesParitaria)) {
$this->comisionesParitarias->add($comisionesParitaria);
$comisionesParitaria->addPersona($this);
}
return $this;
}
public function removeComisionesParitaria(ComisionParitaria $comisionesParitaria): static
{
if ($this->comisionesParitarias->removeElement($comisionesParitaria)) {
$comisionesParitaria->removePersona($this);
}
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->setPersona($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->getPersona() === $this) {
$empresa->setPersona(null);
}
}
return $this;
}
public function getNombreCompleto(): string
{
return implode(' ', [$this->getNombre(), $this->getPrimerApellido(), $this->getSegundoApellido()])??'---';
}
/**
* @return Collection<int, OrganoRepresentacion>
*/
public function getOrganosRepresentacion(): Collection
{
return $this->organosRepresentacion;
}
public function addOrganosRepresentacion(OrganoRepresentacion $organosRepresentacion): static
{
if (!$this->organosRepresentacion->contains($organosRepresentacion)) {
$this->organosRepresentacion->add($organosRepresentacion);
$organosRepresentacion->addPersonasContacto($this);
}
return $this;
}
public function removeOrganosRepresentacion(OrganoRepresentacion $organosRepresentacion): static
{
if ($this->organosRepresentacion->removeElement($organosRepresentacion)) {
$organosRepresentacion->removePersonasContacto($this);
}
return $this;
}
/**
* @return Collection<int, Representacion>
*/
public function getRepresentacions(): Collection
{
return $this->representacions;
}
public function addRepresentacion(Representacion $representacion): static
{
if (!$this->representacions->contains($representacion)) {
$this->representacions->add($representacion);
$representacion->setRepresentante($this);
}
return $this;
}
public function removeRepresentacion(Representacion $representacion): static
{
if ($this->representacions->removeElement($representacion)) {
// set the owning side to null (unless already changed)
if ($representacion->getRepresentante() === $this) {
$representacion->setRepresentante(null);
}
}
return $this;
}
public function getResponsabilidad(): ?string
{
return $this->responsabilidad;
}
public function setResponsabilidad(?string $responsabilidad): static
{
$this->responsabilidad = $responsabilidad;
return $this;
}
public function getSedeResponsable(): ?Sede
{
return $this->sedeResponsable;
}
public function setSedeResponsable(?Sede $sedeResponsable): static
{
// unset the owning side of the relation if necessary
if ($sedeResponsable === null && $this->sedeResponsable !== null) {
$this->sedeResponsable->setResponsable(null);
}
// set the owning side of the relation if necessary
if ($sedeResponsable !== null && $sedeResponsable->getResponsable() !== $this) {
$sedeResponsable->setResponsable($this);
}
$this->sedeResponsable = $sedeResponsable;
return $this;
}
/**
* @return Collection<int, ConsortiumLaboral>
*/
public function getConsortiumLaboralss(): Collection
{
return $this->consortiumLaboralss;
}
public function addConsortiumLaboralss(ConsortiumLaboral $consortiumLaboralss): static
{
if (!$this->consortiumLaboralss->contains($consortiumLaboralss)) {
$this->consortiumLaboralss->add($consortiumLaboralss);
$consortiumLaboralss->addPersona($this);
}
return $this;
}
public function removeConsortiumLaboralss(ConsortiumLaboral $consortiumLaboralss): static
{
if ($this->consortiumLaboralss->removeElement($consortiumLaboralss)) {
$consortiumLaboralss->removePersona($this);
}
return $this;
}
/**
* @return Collection<int, Sector>
*/
public function getSectors(): Collection
{
return $this->sectors;
}
public function addSector(Sector $sector): static
{
if (!$this->sectors->contains($sector)) {
$this->sectors->add($sector);
$sector->addPersona($this);
}
return $this;
}
public function removeSector(Sector $sector): static
{
if ($this->sectors->removeElement($sector)) {
$sector->removePersona($this);
}
return $this;
}
}//class