From 966bfd16148023c419233d0270d7e3146aa4455e Mon Sep 17 00:00:00 2001 From: Wilmer Date: Tue, 9 May 2017 08:45:20 -0400 Subject: [PATCH] mejorar la validacion de primer nombre y segundo nombre en la solicitud de ingreso al cea; mejora la visualizacion del estado asociado al eje --- src/AppBundle/Controller/PortalController.php | 6 +++++- src/AppBundle/Entity/EjeParroquia.php | 11 +++++++++++ src/AppBundle/Form/SolicitarType.php | 22 ++++++++++++++++------ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/AppBundle/Controller/PortalController.php b/src/AppBundle/Controller/PortalController.php index 9b6e13f..13af133 100644 --- a/src/AppBundle/Controller/PortalController.php +++ b/src/AppBundle/Controller/PortalController.php @@ -20,7 +20,11 @@ class PortalController extends Controller if ($form->isSubmitted() && $form->isValid()) { $persona = $this->getDoctrine()->getRepository('AppBundle:Persona') - ->findOneByCedulaPasaporte($form->get('cedula')->getData()); + ->findOneBy(array( + 'cedulaPasaporte' => $form->get('cedula')->getData(), + 'primerNombre' => ucwords($form->get('nombres')->getData()), + 'primerApellido' => ucwords($form->get('apellidos')->getData()), + )); if (!$persona) { $this->addFlash('danger', 'Docente no Registrado en la Base de Datos del Centro de Estudios. Por Favor consulte con el Coordinador Regional del CEA'); diff --git a/src/AppBundle/Entity/EjeParroquia.php b/src/AppBundle/Entity/EjeParroquia.php index 7f9780b..85dc957 100644 --- a/src/AppBundle/Entity/EjeParroquia.php +++ b/src/AppBundle/Entity/EjeParroquia.php @@ -109,6 +109,17 @@ class EjeParroquia /** + * Get estado + * + * @return string + */ + public function getEstado() + { + return $this->getIdParroquia()->getIdMunicipio()->getIdEstado()->getNombre(); + } + + + /** * Get nombre * * @return string diff --git a/src/AppBundle/Form/SolicitarType.php b/src/AppBundle/Form/SolicitarType.php index 265f47d..69c579d 100644 --- a/src/AppBundle/Form/SolicitarType.php +++ b/src/AppBundle/Form/SolicitarType.php @@ -21,7 +21,7 @@ use Symfony\Component\Validator\Constraints\Email; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; use Doctrine\ORM\EntityRepository; - +use Symfony\Component\Validator\Constraints\Regex; class SolicitarType extends AbstractType @@ -34,17 +34,27 @@ class SolicitarType extends AbstractType { $builder ->add('nombres', TextType::class, array( - 'attr' => array('placeholder' => 'Nombres...'), + 'attr' => array('placeholder' => 'Primer Nombre...'), + 'label' => 'Primer Nombre', 'constraints' => array( new NotBlank(), - new Length(array('min' => 3)), + new Regex(array( + 'pattern' => '/^([a-zA-ZáéíóúÁÉÍÓÚñÑ\']{2,30}\S+)$/', + 'match' => true, + 'message' => 'no debe contener espacios ni números y tener mínino tres caracteres.' + )) ) )) ->add('apellidos', TextType::class, array( - 'attr' => array('placeholder' => 'Apellidos...'), + 'attr' => array('placeholder' => 'Primer Apellido...'), + 'label' => 'Primer Apellido', 'constraints' => array( new NotBlank(), - new Length(array('min' => 3)), + new Regex(array( + 'pattern' => '/^([a-zA-ZáéíóúÁÉÍÓÚñÑ\']{2,30}\S+)$/', + 'match' => true, + 'message' => 'no debe contener espacios ni números y tener mínino tres caracteres.' + )) ) )) ->add('cedula', NumberType::class, array( @@ -91,7 +101,7 @@ class SolicitarType extends AbstractType 'placeholder' => 'Seleccione Estado del Eje', 'label' => 'Estado', 'class' => 'AppBundle:EjeParroquia', - + 'choice_label' => 'estado', 'constraints' => array( new NotBlank() ) -- 2.0.0