Last active
September 28, 2015 17:36
-
-
Save JuanLuisGarciaBorrego/cab1a4e08d1b53da3733 to your computer and use it in GitHub Desktop.
Creación del formulario en el controlador antes de recibir 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() | |
{ | |
$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() //Enviamos a la vista el formulario llamando al método | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment