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
interfaz DeleteInterface | |
{ | |
public function delete($data); | |
} |
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
class ArticleRepository implements CRUInterface, DeleteInterface | |
{ | |
public function insert($data) | |
{ | |
//acción insert en BD | |
} | |
public function update($data) | |
{ | |
//acción update en BD | |
} |
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
class UserRepository implements CRUInterface | |
{ | |
public function insert($data) | |
{ | |
//acción insert en BD | |
} | |
public function update($data) | |
{ | |
//acción update en BD | |
} |
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
interface CRUDInterface extends CRUInterface, DeleteInterface | |
{ | |
} |
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
class ArticleRepository implements CRUDInterface | |
{ | |
public function insert($data) | |
{ | |
//acción insert en BD | |
} | |
public function update($data) | |
{ | |
//acción update en BD | |
} |
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( |
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( |
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 |
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("/formularios-equipos", name="formulariosEquipos") | |
*/ | |
public function formulariosEquiposAction() | |
{ | |
$equipos = $this->getDoctrine()->getManager()->getRepository('AppBundle:Equipo')->findAll(); //Devuelve un array de objetos | |
$forms = []; //creo una variable tipo array. | |
foreach($equipos as $equipo) { |
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
{% for form in formsRender %} | |
{{ form_start(form) }} | |
{{ form_errors(form) }} | |
{{ form_widget(form) }} | |
<input type="submit" value="Enviar"> | |
{{ form_end(form) }} | |
<hr> | |
{% endfor %} |