Skip to content

Instantly share code, notes, and snippets.

@JuanLuisGarciaBorrego
Last active September 28, 2015 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JuanLuisGarciaBorrego/3a6c958dd3ab073eb3da to your computer and use it in GitHub Desktop.
Save JuanLuisGarciaBorrego/3a6c958dd3ab073eb3da to your computer and use it in GitHub Desktop.
Manejo de la petición
/**
* @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