Last active
September 28, 2015 17:42
-
-
Save JuanLuisGarciaBorrego/3a6c958dd3ab073eb3da to your computer and use it in GitHub Desktop.
Manejo de la petición
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @Route("/crear-equipo", name="crearEquipo") | |
*/ | |
public function crearEquipoAction(Request $request)//Recibimos la respuesta tipo objeto Request | |
{ | |
$equipo = new Equipo(); | |
$form = $this->createForm(new EquipoType(), $equipo); | |
$form->handleRequest($request); //pasamos la respuesta al habdleRequest | |
if($form->isValid()) { | |
//realizar acciones | |
$em = $this->getDoctrine()->getManager(); | |
$em->persist($equipo); | |
$em->flush(); | |
return $this->redirectToRoute('homepage'); | |
} | |
return $this->render('default/crear.html.twig', array( | |
'form' => $form->createView() | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment