getDoctrine()->getManager(); $centroEstudios = $em->getRepository('UBVSurUbvBundle:CentroEstudio')->findAll(); return $this->render('centroestudio/index.html.twig', array( 'centroEstudios' => $centroEstudios, )); } /** * Creates a new centroEstudio entity. * * @Route("/new", name="centroestudio_new") * @Method({"GET", "POST"}) */ public function newAction(Request $request) { $centroEstudio = new Centroestudio(); $form = $this->createForm('UBV\SurUbvBundle\Form\CentroEstudioType', $centroEstudio); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($centroEstudio); $em->flush(); return $this->redirectToRoute('centroestudio_show', array('id' => $centroEstudio->getId())); } return $this->render('centroestudio/new.html.twig', array( 'centroEstudio' => $centroEstudio, 'form' => $form->createView(), )); } /** * Finds and displays a centroEstudio entity. * * @Route("/{id}", name="centroestudio_show") * @Method("GET") */ public function showAction(CentroEstudio $centroEstudio) { $deleteForm = $this->createDeleteForm($centroEstudio); return $this->render('centroestudio/show.html.twig', array( 'centroEstudio' => $centroEstudio, 'delete_form' => $deleteForm->createView(), )); } /** * Displays a form to edit an existing centroEstudio entity. * * @Route("/{id}/edit", name="centroestudio_edit") * @Method({"GET", "POST"}) */ public function editAction(Request $request, CentroEstudio $centroEstudio) { $deleteForm = $this->createDeleteForm($centroEstudio); $editForm = $this->createForm('UBV\SurUbvBundle\Form\CentroEstudioType', $centroEstudio); $editForm->handleRequest($request); if ($editForm->isSubmitted() && $editForm->isValid()) { $this->getDoctrine()->getManager()->flush(); return $this->redirectToRoute('centroestudio_edit', array('id' => $centroEstudio->getId())); } return $this->render('centroestudio/edit.html.twig', array( 'centroEstudio' => $centroEstudio, 'edit_form' => $editForm->createView(), 'delete_form' => $deleteForm->createView(), )); } /** * Deletes a centroEstudio entity. * * @Route("/{id}", name="centroestudio_delete") * @Method("DELETE") */ public function deleteAction(Request $request, CentroEstudio $centroEstudio) { $form = $this->createDeleteForm($centroEstudio); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->remove($centroEstudio); $em->flush(); } return $this->redirectToRoute('centroestudio_index'); } /** * Creates a form to delete a centroEstudio entity. * * @param CentroEstudio $centroEstudio The centroEstudio entity * * @return \Symfony\Component\Form\Form The form */ private function createDeleteForm(CentroEstudio $centroEstudio) { return $this->createFormBuilder() ->setAction($this->generateUrl('centroestudio_delete', array('id' => $centroEstudio->getId()))) ->setMethod('DELETE') ->getForm() ; } }