Commit e5c4ad4d8f6217d8e793c6a914e3f458ebba6080
1 parent
53f174811a
Exists in
master
agregado solo las secciones de la oferta para modificar inscripcion
Showing
2 changed files
with
16 additions
and
3 deletions
Show diff stats
src/AppBundle/Controller/InscripcionController.php
@@ -104,7 +104,7 @@ class InscripcionController extends Controller | @@ -104,7 +104,7 @@ class InscripcionController extends Controller | ||
104 | $em = $this->getDoctrine()->getManager(); | 104 | $em = $this->getDoctrine()->getManager(); |
105 | $deleteForm = $this->createDeleteForm($inscripcion); | 105 | $deleteForm = $this->createDeleteForm($inscripcion); |
106 | $estado_academico = $em->getRepository('AppBundle:EstadoAcademico')->findOneByIdRolInstitucion($this->getUser()->getIdRolInstitucion()); | 106 | $estado_academico = $em->getRepository('AppBundle:EstadoAcademico')->findOneByIdRolInstitucion($this->getUser()->getIdRolInstitucion()); |
107 | - $editForm = $this->createForm('AppBundle\Form\InscripcionEditType', $inscripcion); | 107 | + $editForm = $this->createForm('AppBundle\Form\InscripcionEditType', $inscripcion, array('oferta' => $inscripcion->getIdSeccion()->getOfertaAcademica()->getId())); |
108 | $editForm->handleRequest($request); | 108 | $editForm->handleRequest($request); |
109 | 109 | ||
110 | if ($editForm->isSubmitted() && $editForm->isValid()) { | 110 | if ($editForm->isSubmitted() && $editForm->isValid()) { |
src/AppBundle/Form/InscripcionEditType.php
@@ -6,6 +6,7 @@ use Symfony\Component\Form\AbstractType; | @@ -6,6 +6,7 @@ use Symfony\Component\Form\AbstractType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | 6 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolver; | 7 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | use Symfony\Bridge\Doctrine\Form\Type\EntityType; | 8 | use Symfony\Bridge\Doctrine\Form\Type\EntityType; |
9 | +use Doctrine\ORM\EntityRepository; | ||
9 | 10 | ||
10 | class InscripcionEditType extends AbstractType | 11 | class InscripcionEditType extends AbstractType |
11 | { | 12 | { |
@@ -15,8 +16,19 @@ class InscripcionEditType extends AbstractType | @@ -15,8 +16,19 @@ class InscripcionEditType extends AbstractType | ||
15 | */ | 16 | */ |
16 | public function buildForm(FormBuilderInterface $builder, array $options) | 17 | public function buildForm(FormBuilderInterface $builder, array $options) |
17 | { | 18 | { |
19 | + $this->oferta = $options['oferta']; | ||
18 | $builder | 20 | $builder |
19 | - ->add('idSeccion') | 21 | + ->add('idSeccion', EntityType::class, array( |
22 | + 'class' => 'AppBundle:Seccion', | ||
23 | + 'query_builder' => function (EntityRepository $er){ | ||
24 | + return $er->createQueryBuilder('u') | ||
25 | + ->where('u.ofertaAcademica = ?1') | ||
26 | + ->setParameters(array( | ||
27 | + 1 => $this->oferta | ||
28 | + )); | ||
29 | + | ||
30 | + }, | ||
31 | + )) | ||
20 | ->add('idEstatus') | 32 | ->add('idEstatus') |
21 | 33 | ||
22 | ; | 34 | ; |
@@ -28,7 +40,8 @@ class InscripcionEditType extends AbstractType | @@ -28,7 +40,8 @@ class InscripcionEditType extends AbstractType | ||
28 | public function configureOptions(OptionsResolver $resolver) | 40 | public function configureOptions(OptionsResolver $resolver) |
29 | { | 41 | { |
30 | $resolver->setDefaults(array( | 42 | $resolver->setDefaults(array( |
31 | - 'data_class' => 'AppBundle\Entity\Inscripcion', | 43 | + 'data_class' => 'AppBundle\Entity\Inscripcion', |
44 | + 'oferta' => null | ||
32 | )); | 45 | )); |
33 | } | 46 | } |
34 | } | 47 | } |