<?php
namespace App\Entity;
use App\Enum\GeneroEnum;
use ArrayAccess;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="participante")
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="type", type="string")
* @ORM\DiscriminatorMap({"participante":"App\Entity\Participante"})
*/
class Participante extends PropietarioContenido implements ArrayAccess
{
/**
* @ORM\Column(type="string", nullable=true, enumType="App\Enum\GeneroEnum")
*/
protected $genero;
/**
* @ORM\Column(type="json", nullable=true)
*/
protected $datosAcademicos;
/**
* @ORM\Column(type="json", nullable=true)
*/
protected $datosProfesionales;
/**
* @ORM\Column(type="json", nullable=true)
*/
protected $datosFormativos;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $geolocalizacion;
/**
* @ORM\Column(type="json", nullable=true)
*/
protected $notificaciones;
/**
* @ORM\Column(type="json", nullable=true)
*/
protected $autorizaciones;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $visibilidad;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $idioma;
/**
* @ORM\Column(type="string", nullable=true, name="pais_origen")
*/
protected $paisOrigen;
/**
* @ORM\Column(type="datetime", nullable=true, name="fecha_nacimiento")
*/
protected $fechaNacimiento;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $estudios;
/**
* @ORM\Column(type="string", nullable=true, name="categoria_profesional")
*/
protected $categoriaProfesional;
/**
* @ORM\Column(type="json", nullable=true)
*/
private $colectivo;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $verificacionCuenta;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $aceptaConsentimiento;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $origen;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected $fechaSincronizacion;
/**
* @ORM\Column(type="boolean", nullable=true, name="info_datos_formativos_public", options={"default":false})
*/
protected $infoDatosFormativosPublic;
/**
* @ORM\Column(type="boolean", nullable=true, name="info_telefono_public", options={"default":false})
*/
protected $infoTelefonoPublic;
/**
* @ORM\Column(type="boolean", nullable=true, name="info_email_public", options={"default":false})
*/
protected $infoEmailPublic;
/**
* @ORM\Column(type="boolean", nullable=true, name="info_nss_public", options={"default":false})
*/
protected $infoNssPublic;
/**
* @ORM\OneToMany(targetEntity=\App\Entity\ParticipanteGrupoDetalle::class, mappedBy="participante")
*/
private $participanteGrupoDetalle;
/**
* @ORM\ManyToOne(targetEntity=\App\Entity\Empresa::class, inversedBy="trabajadores")
* @ORM\JoinColumn(name="empresa_id", referencedColumnName="id")
*/
protected $empresa;
/**
* @ORM\ManyToMany(targetEntity=\App\Entity\EntidadColaboradora::class, inversedBy="participantes")
* @ORM\JoinTable(
* name="representa",
* joinColumns={@ORM\JoinColumn(name="participante_id", referencedColumnName="id", nullable=false)},
* inverseJoinColumns={@ORM\JoinColumn(name="entidad_colaboradora_id", referencedColumnName="id", nullable=false)}
* )
*/
protected $entidadColaboradoras;
public function __construct()
{
$this->entidadColaboradoras = new ArrayCollection();
$this->participanteGrupoDetalle = new ArrayCollection();
}
public function getDatosAcademicos(): ?array
{
return $this->datosAcademicos;
}
public function setDatosAcademicos(?array $datosAcademicos): static
{
$this->datosAcademicos = $datosAcademicos;
return $this;
}
public function getDatosProfesionales(): ?array
{
return $this->datosProfesionales;
}
public function setDatosProfesionales(?array $datosProfesionales): static
{
$this->datosProfesionales = $datosProfesionales;
return $this;
}
public function getDatosFormativos(): ?array
{
return $this->datosFormativos;
}
public function setDatosFormativos(?array $datosFormativos): static
{
$this->datosFormativos = $datosFormativos;
return $this;
}
public function getGeolocalizacion(): ?string
{
return $this->geolocalizacion;
}
public function setGeolocalizacion(?string $geolocalizacion): static
{
$this->geolocalizacion = $geolocalizacion;
return $this;
}
public function getNotificaciones(): ?array
{
return $this->notificaciones;
}
public function setNotificaciones(?array $notificaciones): static
{
$this->notificaciones = $notificaciones;
return $this;
}
public function getAutorizaciones(): ?array
{
return $this->autorizaciones;
}
public function setAutorizaciones(?array $autorizaciones): static
{
$this->autorizaciones = $autorizaciones;
return $this;
}
public function getVisibilidad(): ?string
{
return $this->visibilidad;
}
public function setVisibilidad(?string $visibilidad): static
{
$this->visibilidad = $visibilidad;
return $this;
}
public function getIdioma(): ?string
{
return $this->idioma;
}
public function setIdioma(?string $idioma): static
{
$this->idioma = $idioma;
return $this;
}
public function isVerificacionCuenta(): ?bool
{
return $this->verificacionCuenta;
}
public function setVerificacionCuenta(?bool $verificacionCuenta): static
{
$this->verificacionCuenta = $verificacionCuenta;
return $this;
}
public function isAceptaConsentimiento(): ?bool
{
return $this->aceptaConsentimiento;
}
public function setAceptaConsentimiento(?bool $aceptaConsentimiento): static
{
$this->aceptaConsentimiento = $aceptaConsentimiento;
return $this;
}
public function getOrigen(): ?string
{
return $this->origen;
}
public function setOrigen(?string $origen): static
{
$this->origen = $origen;
return $this;
}
public function getFechaSincronizacion(): ?DateTimeInterface
{
return $this->fechaSincronizacion;
}
public function setFechaSincronizacion(?DateTimeInterface $fechaSincronizacion): static
{
$this->fechaSincronizacion = $fechaSincronizacion;
return $this;
}
public function getEmpresa(): ?Empresa
{
return $this->empresa;
}
public function setEmpresa(?Empresa $empresa): static
{
$this->empresa = $empresa;
return $this;
}
/**
* @return Collection<int, EntidadColaboradora>
*/
public function getEntidadColaboradoras(): Collection
{
return $this->entidadColaboradoras;
}
public function addEntidadColaboradora(EntidadColaboradora $entidadColaboradora): static
{
if (!$this->entidadColaboradoras->contains($entidadColaboradora)) {
$this->entidadColaboradoras->add($entidadColaboradora);
}
return $this;
}
public function removeEntidadColaboradora(EntidadColaboradora $entidadColaboradora): static
{
$this->entidadColaboradoras->removeElement($entidadColaboradora);
return $this;
}
public function getCursos(): ?Collection
{
$cursos = new ArrayCollection();
/*foreach($this->getCertificados() as $certificado)
{
$cursos->add($certificado->getCurso());
}*/
return $cursos;
}
public function getPaisOrigen(): ?string
{
return $this->paisOrigen;
}
public function setPaisOrigen(?string $paisOrigen): static
{
$this->paisOrigen = $paisOrigen;
return $this;
}
public function getEstudios(): ?string
{
return $this->estudios;
}
public function setEstudios(?string $estudios): static
{
$this->estudios = $estudios;
return $this;
}
public function getCategoriaProfesional(): ?string
{
return $this->categoriaProfesional;
}
public function setCategoriaProfesional(?string $categoriaProfesional): static
{
$this->categoriaProfesional = $categoriaProfesional;
return $this;
}
public function isInfoDatosFormativosPublic(): ?bool
{
return $this->infoDatosFormativosPublic;
}
public function setInfoDatosFormativosPublic(?bool $infoDatosFormativosPublic): static
{
$this->infoDatosFormativosPublic = $infoDatosFormativosPublic;
return $this;
}
public function isInfoTelefonoPublic(): ?bool
{
return $this->infoTelefonoPublic;
}
public function setInfoTelefonoPublic(?bool $infoTelefonoPublic): static
{
$this->infoTelefonoPublic = $infoTelefonoPublic;
return $this;
}
public function isInfoEmailPublic(): ?bool
{
return $this->infoEmailPublic;
}
public function setInfoEmailPublic(?bool $infoEmailPublic): static
{
$this->infoEmailPublic = $infoEmailPublic;
return $this;
}
public function isInfoNssPublic(): ?bool
{
return $this->infoNssPublic;
}
public function setInfoNssPublic(?bool $infoNssPublic): static
{
$this->infoNssPublic = $infoNssPublic;
return $this;
}
public function getGenero(): ?GeneroEnum
{
return $this->genero; //? $this->genero->label() : null;
}
public function setGenero(?GeneroEnum $genero): static
{
$this->genero = $genero; //GeneroEnum::tryFrom($genero);
return $this;
}
public function getFechaNacimiento(): ?DateTimeInterface
{
return $this->fechaNacimiento;
}
public function setFechaNacimiento(?DateTimeInterface $fechaNacimiento): static
{
$this->fechaNacimiento = $fechaNacimiento;
return $this;
}
public function getGrupos(): Collection
{
$grupos = new ArrayCollection();
/** @var ParticipanteGrupoDetalle[] $pgds */
$pgds = $this->getParticipanteGrupoDetalle();
foreach ($pgds as $pgd) {
//foreach ($pgd->getParticipantesGrupos() as $participanteGrupo) {
$grupo = $pgd?->getParticipantesGrupos()?->getGrupo();
if ($grupo && !$grupos->contains($grupo)) {
$grupos->add($grupo);
}
//}
}
return $grupos;
}
public function offsetExists(mixed $offset): bool
{
return property_exists($this, $offset);
}
public function offsetGet(mixed $offset): mixed
{
return $this->$offset ?? null;
}
public function offsetSet(mixed $offset, mixed $value): void
{
$this->$offset = $value;
}
public function offsetUnset(mixed $offset): void
{
if (property_exists($this, $offset)) {
unset($this->$offset);
}
}
/**
* @return Collection<int, ParticipanteGrupoDetalle>
*/
public function getParticipanteGrupoDetalle(): Collection
{
return $this->participanteGrupoDetalle;
}
public function addParticipanteGrupoDetalle(ParticipanteGrupoDetalle $participanteGrupoDetalle): static
{
if (!$this->participanteGrupoDetalle->contains($participanteGrupoDetalle)) {
$this->participanteGrupoDetalle->add($participanteGrupoDetalle);
$participanteGrupoDetalle->setParticipante($this);
}
return $this;
}
public function removeParticipanteGrupoDetalle(ParticipanteGrupoDetalle $participanteGrupoDetalle): static
{
if ($this->participanteGrupoDetalle->removeElement($participanteGrupoDetalle)) {
// set the owning side to null (unless already changed)
if ($participanteGrupoDetalle->getParticipante() === $this) {
$participanteGrupoDetalle->setParticipante(null);
}
}
return $this;
}
public function getColectivo(): ?array
{
return $this->colectivo;
}
public function setColectivo(?array $colectivo): static
{
$this->colectivo = $colectivo;
return $this;
}
}