src/Entity/InscripcionUsuarioJornadaCurso.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\InscripcionUsuarioJornadaCursoRepository;
  4. use DateTime;
  5. use DateTimeInterface;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use App\Validator as CustomAssert;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. #[UniqueEntity(
  12. fields: ['email', 'jornadaCurso'],
  13. message: 'Ya hay un registro con ese email en esta jornada.',
  14. )]
  15. #[UniqueEntity(
  16. fields: ['dniNie', 'jornadaCurso'],
  17. message: 'Ya hay un registro con ese DNI/NIE en esta jornada.',
  18. )]
  19. #[ORM\Entity(repositoryClass: InscripcionUsuarioJornadaCursoRepository::class)]
  20. class InscripcionUsuarioJornadaCurso
  21. {
  22. #[ORM\Id]
  23. #[ORM\GeneratedValue]
  24. #[ORM\Column]
  25. private ?int $id = null;
  26. #[ORM\ManyToOne(inversedBy: 'inscripcionesUsuariosJornadasCursos')]
  27. #[ORM\JoinColumn(nullable: false)]
  28. private ?JornadaCurso $jornadaCurso = null;
  29. #[ORM\Column(type: Types::DATETIME_MUTABLE)]
  30. private ?DateTimeInterface $fechaHora;
  31. #[Assert\NotBlank]
  32. #[Assert\Email]
  33. #[Assert\Length(max: 190)]
  34. #[ORM\Column(type: 'string', length: 255)]
  35. private ?string $email = null;
  36. #[Assert\NotBlank]
  37. #[Assert\Length(max: 255)]
  38. #[ORM\Column(type: 'string', length: 255)]
  39. private ?string $nombre = null;
  40. #[Assert\NotBlank]
  41. #[Assert\Length(max: 255)]
  42. #[ORM\Column(type: 'string', length: 255)]
  43. private ?string $apellidos = null;
  44. #[Assert\NotBlank]
  45. #[CustomAssert\IsDniNie]
  46. #[ORM\Column(type: 'string', length: 9)]
  47. private ?string $dniNie = null;
  48. #[Assert\NotBlank]
  49. #[ORM\Column(type: 'date', nullable: true)]
  50. private ?DateTimeInterface $fechaNacimiento = null;
  51. #[Assert\NotBlank]
  52. #[ORM\ManyToOne(targetEntity: SexoUsuario::class, inversedBy: 'usuarios')]
  53. private ?SexoUsuario $sexo = null;
  54. #[Assert\NotBlank]
  55. #[ORM\ManyToOne(targetEntity: Localidad::class, inversedBy: 'usuarios')]
  56. private ?Localidad $localidad = null;
  57. #[Assert\NotBlank]
  58. #[ORM\Column(type: 'string', length: 255)]
  59. private ?string $direccion = null;
  60. #[Assert\NotBlank]
  61. #[Assert\Regex(pattern: '/^\d{5}$/')]
  62. #[ORM\Column(type: 'string', length: 5)]
  63. private ?string $codigoPostal = null;
  64. #[Assert\NotBlank]
  65. #[Assert\Regex(pattern: '/^\d{9}$/')]
  66. #[ORM\Column(type: 'string', length: 9)]
  67. private ?string $telefono1 = null;
  68. #[Assert\Regex(pattern: '/^\d{9}$/')]
  69. #[ORM\Column(type: 'string', length: 9, nullable: true)]
  70. private ?string $telefono2 = null;
  71. #[ORM\Column]
  72. private ?bool $aceptaCondicionesPrivacidad = false;
  73. #[ORM\ManyToOne(inversedBy: 'inscripcionesJornadasCursos')]
  74. #[ORM\JoinColumn(nullable: false)]
  75. private ?Usuario $usuario = null;
  76. public function __construct()
  77. {
  78. $this->fechaHora = new DateTime();
  79. }
  80. public function getId(): ?int
  81. {
  82. return $this->id;
  83. }
  84. public function getJornadaCurso(): ?JornadaCurso
  85. {
  86. return $this->jornadaCurso;
  87. }
  88. public function setJornadaCurso(?JornadaCurso $jornadaCurso): static
  89. {
  90. $this->jornadaCurso = $jornadaCurso;
  91. return $this;
  92. }
  93. public function getFechaHora(): ?DateTimeInterface
  94. {
  95. return $this->fechaHora;
  96. }
  97. public function setFechaHora(DateTimeInterface $fechaHora): static
  98. {
  99. $this->fechaHora = $fechaHora;
  100. return $this;
  101. }
  102. public function getEmail(): ?string
  103. {
  104. return $this->email;
  105. }
  106. public function setEmail(?string $email): self
  107. {
  108. $this->email = $email;
  109. return $this;
  110. }
  111. public function getNombre(): ?string
  112. {
  113. return $this->nombre;
  114. }
  115. public function setNombre(?string $nombre): self
  116. {
  117. $this->nombre = $nombre;
  118. return $this;
  119. }
  120. public function getApellidos(): ?string
  121. {
  122. return $this->apellidos;
  123. }
  124. public function setApellidos(?string $apellidos): self
  125. {
  126. $this->apellidos = $apellidos;
  127. return $this;
  128. }
  129. public function getDniNie(): ?string
  130. {
  131. return $this->dniNie;
  132. }
  133. public function setDniNie(?string $dniNie): self
  134. {
  135. $this->dniNie = $dniNie;
  136. return $this;
  137. }
  138. public function getFechaNacimiento(): ?DateTimeInterface
  139. {
  140. return $this->fechaNacimiento;
  141. }
  142. public function setFechaNacimiento(?DateTimeInterface $fechaNacimiento): self
  143. {
  144. $this->fechaNacimiento = $fechaNacimiento;
  145. return $this;
  146. }
  147. public function getSexo(): ?SexoUsuario
  148. {
  149. return $this->sexo;
  150. }
  151. public function setSexo(?SexoUsuario $sexo): self
  152. {
  153. $this->sexo = $sexo;
  154. return $this;
  155. }
  156. public function getLocalidad(): ?Localidad
  157. {
  158. return $this->localidad;
  159. }
  160. public function setLocalidad(?Localidad $localidad): self
  161. {
  162. $this->localidad = $localidad;
  163. return $this;
  164. }
  165. public function getDireccion(): ?string
  166. {
  167. return $this->direccion;
  168. }
  169. public function setDireccion(?string $direccion): self
  170. {
  171. $this->direccion = $direccion;
  172. return $this;
  173. }
  174. public function getCodigoPostal(): ?string
  175. {
  176. return $this->codigoPostal;
  177. }
  178. public function setCodigoPostal(?string $codigoPostal): self
  179. {
  180. $this->codigoPostal = $codigoPostal;
  181. return $this;
  182. }
  183. public function getTelefono1(): ?string
  184. {
  185. return $this->telefono1;
  186. }
  187. public function setTelefono1(?string $telefono1): self
  188. {
  189. $this->telefono1 = $telefono1;
  190. return $this;
  191. }
  192. public function getTelefono2(): ?string
  193. {
  194. return $this->telefono2;
  195. }
  196. public function setTelefono2(?string $telefono2): self
  197. {
  198. $this->telefono2 = $telefono2;
  199. return $this;
  200. }
  201. public function isAceptaCondicionesPrivacidad(): ?bool
  202. {
  203. return $this->aceptaCondicionesPrivacidad;
  204. }
  205. public function setAceptaCondicionesPrivacidad(bool $aceptaCondicionesPrivacidad): static
  206. {
  207. $this->aceptaCondicionesPrivacidad = $aceptaCondicionesPrivacidad;
  208. return $this;
  209. }
  210. public function getUsuario(): ?Usuario
  211. {
  212. return $this->usuario;
  213. }
  214. public function setUsuario(?Usuario $usuario): static
  215. {
  216. $this->usuario = $usuario;
  217. return $this;
  218. }
  219. }