src/Entity/Participante.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\GeneroEnum;
  4. use ArrayAccess;
  5. use DateTimeInterface;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11. * @ORM\Entity
  12. * @ORM\Table(name="participante")
  13. * @ORM\InheritanceType("SINGLE_TABLE")
  14. * @ORM\DiscriminatorColumn(name="type", type="string")
  15. * @ORM\DiscriminatorMap({"participante":"App\Entity\Participante"})
  16. */
  17. class Participante extends PropietarioContenido implements ArrayAccess
  18. {
  19. /**
  20. * @ORM\Column(type="string", nullable=true, enumType="App\Enum\GeneroEnum")
  21. */
  22. protected $genero;
  23. /**
  24. * @ORM\Column(type="json", nullable=true)
  25. */
  26. protected $datosAcademicos;
  27. /**
  28. * @ORM\Column(type="json", nullable=true)
  29. */
  30. protected $datosProfesionales;
  31. /**
  32. * @ORM\Column(type="json", nullable=true)
  33. */
  34. protected $datosFormativos;
  35. /**
  36. * @ORM\Column(type="string", nullable=true)
  37. */
  38. protected $geolocalizacion;
  39. /**
  40. * @ORM\Column(type="json", nullable=true)
  41. */
  42. protected $notificaciones;
  43. /**
  44. * @ORM\Column(type="json", nullable=true)
  45. */
  46. protected $autorizaciones;
  47. /**
  48. * @ORM\Column(type="string", nullable=true)
  49. */
  50. protected $visibilidad;
  51. /**
  52. * @ORM\Column(type="string", nullable=true)
  53. */
  54. protected $idioma;
  55. /**
  56. * @ORM\Column(type="string", nullable=true, name="pais_origen")
  57. */
  58. protected $paisOrigen;
  59. /**
  60. * @ORM\Column(type="datetime", nullable=true, name="fecha_nacimiento")
  61. */
  62. protected $fechaNacimiento;
  63. /**
  64. * @ORM\Column(type="string", nullable=true)
  65. */
  66. protected $estudios;
  67. /**
  68. * @ORM\Column(type="string", nullable=true, name="categoria_profesional")
  69. */
  70. protected $categoriaProfesional;
  71. /**
  72. * @ORM\Column(type="json", nullable=true)
  73. */
  74. private $colectivo;
  75. /**
  76. * @ORM\Column(type="boolean", nullable=true)
  77. */
  78. protected $verificacionCuenta;
  79. /**
  80. * @ORM\Column(type="boolean", nullable=true)
  81. */
  82. protected $aceptaConsentimiento;
  83. /**
  84. * @ORM\Column(type="string", nullable=true)
  85. */
  86. protected $origen;
  87. /**
  88. * @ORM\Column(type="datetime", nullable=true)
  89. */
  90. protected $fechaSincronizacion;
  91. /**
  92. * @ORM\Column(type="boolean", nullable=true, name="info_datos_formativos_public", options={"default":false})
  93. */
  94. protected $infoDatosFormativosPublic;
  95. /**
  96. * @ORM\Column(type="boolean", nullable=true, name="info_telefono_public", options={"default":false})
  97. */
  98. protected $infoTelefonoPublic;
  99. /**
  100. * @ORM\Column(type="boolean", nullable=true, name="info_email_public", options={"default":false})
  101. */
  102. protected $infoEmailPublic;
  103. /**
  104. * @ORM\Column(type="boolean", nullable=true, name="info_nss_public", options={"default":false})
  105. */
  106. protected $infoNssPublic;
  107. /**
  108. * @ORM\OneToMany(targetEntity=\App\Entity\ParticipanteGrupoDetalle::class, mappedBy="participante")
  109. */
  110. private $participanteGrupoDetalle;
  111. /**
  112. * @ORM\ManyToOne(targetEntity=\App\Entity\Empresa::class, inversedBy="trabajadores")
  113. * @ORM\JoinColumn(name="empresa_id", referencedColumnName="id")
  114. */
  115. protected $empresa;
  116. /**
  117. * @ORM\ManyToMany(targetEntity=\App\Entity\EntidadColaboradora::class, inversedBy="participantes")
  118. * @ORM\JoinTable(
  119. * name="representa",
  120. * joinColumns={@ORM\JoinColumn(name="participante_id", referencedColumnName="id", nullable=false)},
  121. * inverseJoinColumns={@ORM\JoinColumn(name="entidad_colaboradora_id", referencedColumnName="id", nullable=false)}
  122. * )
  123. */
  124. protected $entidadColaboradoras;
  125. public function __construct()
  126. {
  127. $this->entidadColaboradoras = new ArrayCollection();
  128. $this->participanteGrupoDetalle = new ArrayCollection();
  129. }
  130. public function getDatosAcademicos(): ?array
  131. {
  132. return $this->datosAcademicos;
  133. }
  134. public function setDatosAcademicos(?array $datosAcademicos): static
  135. {
  136. $this->datosAcademicos = $datosAcademicos;
  137. return $this;
  138. }
  139. public function getDatosProfesionales(): ?array
  140. {
  141. return $this->datosProfesionales;
  142. }
  143. public function setDatosProfesionales(?array $datosProfesionales): static
  144. {
  145. $this->datosProfesionales = $datosProfesionales;
  146. return $this;
  147. }
  148. public function getDatosFormativos(): ?array
  149. {
  150. return $this->datosFormativos;
  151. }
  152. public function setDatosFormativos(?array $datosFormativos): static
  153. {
  154. $this->datosFormativos = $datosFormativos;
  155. return $this;
  156. }
  157. public function getGeolocalizacion(): ?string
  158. {
  159. return $this->geolocalizacion;
  160. }
  161. public function setGeolocalizacion(?string $geolocalizacion): static
  162. {
  163. $this->geolocalizacion = $geolocalizacion;
  164. return $this;
  165. }
  166. public function getNotificaciones(): ?array
  167. {
  168. return $this->notificaciones;
  169. }
  170. public function setNotificaciones(?array $notificaciones): static
  171. {
  172. $this->notificaciones = $notificaciones;
  173. return $this;
  174. }
  175. public function getAutorizaciones(): ?array
  176. {
  177. return $this->autorizaciones;
  178. }
  179. public function setAutorizaciones(?array $autorizaciones): static
  180. {
  181. $this->autorizaciones = $autorizaciones;
  182. return $this;
  183. }
  184. public function getVisibilidad(): ?string
  185. {
  186. return $this->visibilidad;
  187. }
  188. public function setVisibilidad(?string $visibilidad): static
  189. {
  190. $this->visibilidad = $visibilidad;
  191. return $this;
  192. }
  193. public function getIdioma(): ?string
  194. {
  195. return $this->idioma;
  196. }
  197. public function setIdioma(?string $idioma): static
  198. {
  199. $this->idioma = $idioma;
  200. return $this;
  201. }
  202. public function isVerificacionCuenta(): ?bool
  203. {
  204. return $this->verificacionCuenta;
  205. }
  206. public function setVerificacionCuenta(?bool $verificacionCuenta): static
  207. {
  208. $this->verificacionCuenta = $verificacionCuenta;
  209. return $this;
  210. }
  211. public function isAceptaConsentimiento(): ?bool
  212. {
  213. return $this->aceptaConsentimiento;
  214. }
  215. public function setAceptaConsentimiento(?bool $aceptaConsentimiento): static
  216. {
  217. $this->aceptaConsentimiento = $aceptaConsentimiento;
  218. return $this;
  219. }
  220. public function getOrigen(): ?string
  221. {
  222. return $this->origen;
  223. }
  224. public function setOrigen(?string $origen): static
  225. {
  226. $this->origen = $origen;
  227. return $this;
  228. }
  229. public function getFechaSincronizacion(): ?DateTimeInterface
  230. {
  231. return $this->fechaSincronizacion;
  232. }
  233. public function setFechaSincronizacion(?DateTimeInterface $fechaSincronizacion): static
  234. {
  235. $this->fechaSincronizacion = $fechaSincronizacion;
  236. return $this;
  237. }
  238. public function getEmpresa(): ?Empresa
  239. {
  240. return $this->empresa;
  241. }
  242. public function setEmpresa(?Empresa $empresa): static
  243. {
  244. $this->empresa = $empresa;
  245. return $this;
  246. }
  247. /**
  248. * @return Collection<int, EntidadColaboradora>
  249. */
  250. public function getEntidadColaboradoras(): Collection
  251. {
  252. return $this->entidadColaboradoras;
  253. }
  254. public function addEntidadColaboradora(EntidadColaboradora $entidadColaboradora): static
  255. {
  256. if (!$this->entidadColaboradoras->contains($entidadColaboradora)) {
  257. $this->entidadColaboradoras->add($entidadColaboradora);
  258. }
  259. return $this;
  260. }
  261. public function removeEntidadColaboradora(EntidadColaboradora $entidadColaboradora): static
  262. {
  263. $this->entidadColaboradoras->removeElement($entidadColaboradora);
  264. return $this;
  265. }
  266. public function getCursos(): ?Collection
  267. {
  268. $cursos = new ArrayCollection();
  269. /*foreach($this->getCertificados() as $certificado)
  270. {
  271. $cursos->add($certificado->getCurso());
  272. }*/
  273. return $cursos;
  274. }
  275. public function getPaisOrigen(): ?string
  276. {
  277. return $this->paisOrigen;
  278. }
  279. public function setPaisOrigen(?string $paisOrigen): static
  280. {
  281. $this->paisOrigen = $paisOrigen;
  282. return $this;
  283. }
  284. public function getEstudios(): ?string
  285. {
  286. return $this->estudios;
  287. }
  288. public function setEstudios(?string $estudios): static
  289. {
  290. $this->estudios = $estudios;
  291. return $this;
  292. }
  293. public function getCategoriaProfesional(): ?string
  294. {
  295. return $this->categoriaProfesional;
  296. }
  297. public function setCategoriaProfesional(?string $categoriaProfesional): static
  298. {
  299. $this->categoriaProfesional = $categoriaProfesional;
  300. return $this;
  301. }
  302. public function isInfoDatosFormativosPublic(): ?bool
  303. {
  304. return $this->infoDatosFormativosPublic;
  305. }
  306. public function setInfoDatosFormativosPublic(?bool $infoDatosFormativosPublic): static
  307. {
  308. $this->infoDatosFormativosPublic = $infoDatosFormativosPublic;
  309. return $this;
  310. }
  311. public function isInfoTelefonoPublic(): ?bool
  312. {
  313. return $this->infoTelefonoPublic;
  314. }
  315. public function setInfoTelefonoPublic(?bool $infoTelefonoPublic): static
  316. {
  317. $this->infoTelefonoPublic = $infoTelefonoPublic;
  318. return $this;
  319. }
  320. public function isInfoEmailPublic(): ?bool
  321. {
  322. return $this->infoEmailPublic;
  323. }
  324. public function setInfoEmailPublic(?bool $infoEmailPublic): static
  325. {
  326. $this->infoEmailPublic = $infoEmailPublic;
  327. return $this;
  328. }
  329. public function isInfoNssPublic(): ?bool
  330. {
  331. return $this->infoNssPublic;
  332. }
  333. public function setInfoNssPublic(?bool $infoNssPublic): static
  334. {
  335. $this->infoNssPublic = $infoNssPublic;
  336. return $this;
  337. }
  338. public function getGenero(): ?GeneroEnum
  339. {
  340. return $this->genero; //? $this->genero->label() : null;
  341. }
  342. public function setGenero(?GeneroEnum $genero): static
  343. {
  344. $this->genero = $genero; //GeneroEnum::tryFrom($genero);
  345. return $this;
  346. }
  347. public function getFechaNacimiento(): ?DateTimeInterface
  348. {
  349. return $this->fechaNacimiento;
  350. }
  351. public function setFechaNacimiento(?DateTimeInterface $fechaNacimiento): static
  352. {
  353. $this->fechaNacimiento = $fechaNacimiento;
  354. return $this;
  355. }
  356. public function getGrupos(): Collection
  357. {
  358. $grupos = new ArrayCollection();
  359. /** @var ParticipanteGrupoDetalle[] $pgds */
  360. $pgds = $this->getParticipanteGrupoDetalle();
  361. foreach ($pgds as $pgd) {
  362. //foreach ($pgd->getParticipantesGrupos() as $participanteGrupo) {
  363. $grupo = $pgd?->getParticipantesGrupos()?->getGrupo();
  364. if ($grupo && !$grupos->contains($grupo)) {
  365. $grupos->add($grupo);
  366. }
  367. //}
  368. }
  369. return $grupos;
  370. }
  371. public function offsetExists(mixed $offset): bool
  372. {
  373. return property_exists($this, $offset);
  374. }
  375. public function offsetGet(mixed $offset): mixed
  376. {
  377. return $this->$offset ?? null;
  378. }
  379. public function offsetSet(mixed $offset, mixed $value): void
  380. {
  381. $this->$offset = $value;
  382. }
  383. public function offsetUnset(mixed $offset): void
  384. {
  385. if (property_exists($this, $offset)) {
  386. unset($this->$offset);
  387. }
  388. }
  389. /**
  390. * @return Collection<int, ParticipanteGrupoDetalle>
  391. */
  392. public function getParticipanteGrupoDetalle(): Collection
  393. {
  394. return $this->participanteGrupoDetalle;
  395. }
  396. public function addParticipanteGrupoDetalle(ParticipanteGrupoDetalle $participanteGrupoDetalle): static
  397. {
  398. if (!$this->participanteGrupoDetalle->contains($participanteGrupoDetalle)) {
  399. $this->participanteGrupoDetalle->add($participanteGrupoDetalle);
  400. $participanteGrupoDetalle->setParticipante($this);
  401. }
  402. return $this;
  403. }
  404. public function removeParticipanteGrupoDetalle(ParticipanteGrupoDetalle $participanteGrupoDetalle): static
  405. {
  406. if ($this->participanteGrupoDetalle->removeElement($participanteGrupoDetalle)) {
  407. // set the owning side to null (unless already changed)
  408. if ($participanteGrupoDetalle->getParticipante() === $this) {
  409. $participanteGrupoDetalle->setParticipante(null);
  410. }
  411. }
  412. return $this;
  413. }
  414. public function getColectivo(): ?array
  415. {
  416. return $this->colectivo;
  417. }
  418. public function setColectivo(?array $colectivo): static
  419. {
  420. $this->colectivo = $colectivo;
  421. return $this;
  422. }
  423. }