Skip to content

Instantly share code, notes, and snippets.

@JuanLuisGarciaBorrego
Created September 28, 2015 17:24
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/09f825155af5dd6b0cc1 to your computer and use it in GitHub Desktop.
Save JuanLuisGarciaBorrego/09f825155af5dd6b0cc1 to your computer and use it in GitHub Desktop.
Creación del formulario en el controlador antes de recibir la petición
/**
* @Route("/crear-equipo", name="crearEquipo")
*/
public function crearEquipoAction()
{
$equipo = new Equipo(); //1-Instancio la entidad
$form = $this->createForm(new EquipoType(), $equipo); //Utilizo el formulario tipo y le paso el objeto Equipo.
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