src/Entity/Registro/RegistroAspirante.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Registro;
  3. use App\Repository\Registro\RegistroAspiranteRepository;
  4. use App\Entity\SsoMatricula;
  5. use App\Entity\SsoPersona;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Doctrine\Persistence\Event\LifecycleEventArgs;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. use App\Validator as AppAssert;
  10. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  11. /**
  12.  * @ORM\Entity(repositoryClass=RegistroAspiranteRepository::class)
  13.  * @ORM\HasLifecycleCallbacks()
  14.  * @UniqueEntity("dni", repositoryMethod="findRegistroPendiente", message="Ya tiene un registro presentado pendiente de verificación, por favor aguarde respuesta del mismo.")
  15.  */
  16. class RegistroAspirante
  17. {
  18.     public const ESTADO_INICIADO 'Iniciado';
  19.     public const ESTADO_ADJUNTOS 'Adjuntos';
  20.     public const ESTADO_CORREO 'Correo';
  21.     public const ESTADO_ESCUELA 'Escuela';
  22.     public const ESTADO_RECHAZADO 'Rechazado';
  23.     public const ESTADO_CONFIRMADO 'Confirmado';
  24.     public const ESTADO_CONFIRMADO_ESCUELA 'Confirmado_escuela';
  25.     public const ESTADO_VENCIDO 'Vencido';
  26.     /**
  27.      * @ORM\Id
  28.      * @ORM\GeneratedValue
  29.      * @ORM\Column(type="integer")
  30.      */
  31.     private $id;
  32.     /**
  33.      * @ORM\Column(type="string", length=150)
  34.      * @Assert\NotBlank(
  35.      *     message = "Campo requerido."
  36.      * )
  37.      * @Assert\Length(
  38.      *      min = 3,
  39.      *      max = 150,
  40.      *      minMessage = "Tamaño mínimo {{ limit }}",
  41.      *      maxMessage = "Tamaño máximo {{ limit }}"
  42.      * )
  43.      */
  44.     private $nombres;
  45.     /**
  46.      * @ORM\Column(type="string", length=150)
  47.      * @Assert\NotBlank(
  48.      *     message = "Campo requerido."
  49.      * )
  50.      * @Assert\Length(
  51.      *      min = 3,
  52.      *      max = 150,
  53.      *      minMessage = "Tamaño mínimo {{ limit }}",
  54.      *      maxMessage = "Tamaño máximo {{ limit }}"
  55.      * )
  56.      */
  57.     private $apellidos;
  58.     /**
  59.      * @ORM\Column(type="integer")
  60.      * @Assert\NotBlank(
  61.      *     message = "Campo requerido."
  62.      * )
  63.      * @Assert\Range(
  64.      *      min = 1000000,
  65.      *      max = 100000000,
  66.      *      notInRangeMessage = "Número entre {{ min }} y {{ max }}",
  67.      *      invalidMessage = "Número inválido"
  68.      * )
  69.      * @AppAssert\UniquePersona()
  70.      */
  71.     private $dni;
  72.     /**
  73.      * @ORM\Column(type="string", length=255, nullable=true)
  74.      */
  75.     private $urlDni;
  76.     /**
  77.      * @ORM\Column(type="string", length=100, nullable=true)
  78.      * @Assert\Email(
  79.      *     message = "El Email es incorrecto.",
  80.      *     mode= "html5"
  81.      * )
  82.      * @Assert\NotBlank(
  83.      *     message = "Campo requerido."
  84.      * )
  85.      * @AppAssert\UniqueMail()
  86.      */
  87.     private $email_personal;
  88.     /**
  89.      * @var string The hashed password
  90.      * @ORM\Column(type="string")
  91.      * @Assert\Length(
  92.      *      min = 6,
  93.      *      minMessage = "Tamaño mínimo {{ limit }}"
  94.      * )
  95.      * @Assert\NotBlank(
  96.      *     message = "Campo requerido."
  97.      * )
  98.      */
  99.     private $password;
  100.     /**
  101.      * @ORM\Column(type="string", length=20, nullable=true)
  102.      * @Assert\NotBlank(
  103.      *     message = "Campo requerido."
  104.      * )
  105.      * @AppAssert\UniqueDniTramite()
  106.      */
  107.     private $dni_tramite;
  108.     /**
  109.      * @ORM\Column(type="string", length=2, nullable=true)
  110.      * @Assert\Choice(choices=SsoPersona::GENEROS, message="Género inválido.")
  111.      */
  112.     private $genero;
  113.     /**
  114.      * @ORM\OneToOne(targetEntity=SsoMatricula::class, cascade={"all"})
  115.      * @ORM\JoinColumn(nullable=false)
  116.      * @Assert\Valid
  117.      */
  118.     private $matricula;
  119.     /**
  120.      * @ORM\Column(type="string", length=100)
  121.      */
  122.     private $estado;
  123.     /**
  124.      * @ORM\Column(type="datetime", nullable=true)
  125.      */
  126.     private $descargaReglamento;
  127.     /**
  128.      * @ORM\Column(type="datetime", nullable=true)
  129.      */
  130.     private $aceptaReglamento;
  131.     /**
  132.      * @ORM\PrePersist
  133.     */
  134.     public function iniciarPresentacion(LifecycleEventArgs $eventArgs): void
  135.     {
  136.         $this->setAceptaReglamento(new \DateTimeImmutable());
  137.     }
  138.     public function marcarReglamentoDescargado(): void
  139.     {
  140.         $this->descargaReglamento = new \DateTimeImmutable();
  141.     }
  142.     public function getId(): ?int
  143.     {
  144.         return $this->id;
  145.     }
  146.     public function getNombres(): ?string
  147.     {
  148.         return $this->nombres;
  149.     }
  150.     public function setNombres(string $nombres): self
  151.     {
  152.         $this->nombres $nombres;
  153.         return $this;
  154.     }
  155.     public function getApellidos(): ?string
  156.     {
  157.         return $this->apellidos;
  158.     }
  159.     public function setApellidos(string $apellidos): self
  160.     {
  161.         $this->apellidos $apellidos;
  162.         return $this;
  163.     }
  164.     public function getDni(): ?int
  165.     {
  166.         return $this->dni;
  167.     }
  168.     public function setDni(int $dni): self
  169.     {
  170.         $this->dni $dni;
  171.         return $this;
  172.     }
  173.     public function getEmailPersonal(): ?string
  174.     {
  175.         return $this->email_personal;
  176.     }
  177.     public function setEmailPersonal(?string $email_personal): self
  178.     {
  179.         $this->email_personal $email_personal;
  180.         return $this;
  181.     }
  182.     public function getDniTramite(): ?string
  183.     {
  184.         return $this->dni_tramite;
  185.     }
  186.     public function setDniTramite(string $dni_tramite): self
  187.     {
  188.         $this->dni_tramite $dni_tramite;
  189.         return $this;
  190.     }
  191.     public function getGenero(): ?string
  192.     {
  193.         return $this->genero;
  194.     }
  195.     public function setGenero(?string $genero): self
  196.     {
  197.         $this->genero $genero;
  198.         return $this;
  199.     }
  200.     public function getPassword(): ?string
  201.     {
  202.         return $this->password;
  203.     }
  204.     public function setPassword(string $password): self
  205.     {
  206.         $this->password $password;
  207.         return $this;
  208.     }
  209.     public function getMatricula(): ?SsoMatricula
  210.     {
  211.         return $this->matricula;
  212.     }
  213.     public function setMatricula(SsoMatricula $matricula): self
  214.     {
  215.         $this->matricula $matricula;
  216.         return $this;
  217.     }
  218.     public function getUrlDni(): ?string
  219.     {
  220.         return $this->urlDni;
  221.     }
  222.     public function setUrlDni(?string $urlDni): self
  223.     {
  224.         $this->urlDni $urlDni;
  225.         return $this;
  226.     }
  227.     public function getEstado(): ?string
  228.     {
  229.         return $this->estado;
  230.     }
  231.     public function setEstado(string $estado): self
  232.     {
  233.         $this->estado $estado;
  234.         return $this;
  235.     }
  236.     public function getTick(): ?String
  237.     {
  238.         return $this->getDescargaReglamento()?$this->getDescargaReglamento()->format(\DateTimeInterface::ATOM):null;
  239.     }
  240.     public function setTick(?String $tick): self
  241.     {
  242.         $dateTime =  \DateTimeImmutable::createFromFormat(\DateTimeInterface::ATOM$tick);
  243.         $this->setDescargaReglamento($dateTime);
  244.         return $this;
  245.     }
  246.     public function getDescargaReglamento(): ?\DateTimeInterface
  247.     {
  248.         return $this->descargaReglamento;
  249.     }
  250.     public function setDescargaReglamento(?\DateTimeInterface $descargaReglamento): self
  251.     {
  252.         $this->descargaReglamento $descargaReglamento;
  253.         return $this;
  254.     }
  255.     public function getAceptaReglamento(): ?\DateTimeInterface
  256.     {
  257.         return $this->aceptaReglamento;
  258.     }
  259.     public function setAceptaReglamento(?\DateTimeInterface $aceptaReglamento): self
  260.     {
  261.         $this->aceptaReglamento $aceptaReglamento;
  262.         return $this;
  263.     }
  264. }