AutenticacionController.php 1.29 KB
<?php

namespace UBV\AutenticacionBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use UBV\AutenticacionBundle\Form\Type\RegistroAspiranteType;
use Symfony\Component\HttpFoundation\RedirectResponse;

class AutenticacionController extends Controller {

  /**
   * @Route("/", name="autenticacion_principal")
   * @Template()
   */
  public function principalAction() {
    return $this->render('UBVAutenticacionBundle::inicio.html.twig');
  }

  /**
   * @Route("/aspirante/registro/", name="registro_aspirante")
   * @Method({"GET", "POST"})
   */
  public function registroAspiranteAction(Request $request) {

    $form = $this->createForm(RegistroAspiranteType::class);
    $form->handleRequest($request);

    if ($form->isSubmitted() && $form->isValid()) {
      return $this->forward('UBVAutenticacionBundle:Registration:Register');
    }

    return $this->render('UBVAutenticacionBundle:Registration:registro_aspirante.html.twig', array(
      'form' => $form->createView()
    ));
  }
}