mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Removing delete action
This commit is contained in:
parent
f74e3db193
commit
bdbcdd2db9
@ -194,12 +194,9 @@ class ReportController extends Controller
|
|||||||
throw $this->createNotFoundException('Unable to find Report entity.');
|
throw $this->createNotFoundException('Unable to find Report entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
//$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillReportBundle:Report:show.html.twig', array(
|
return $this->render('ChillReportBundle:Report:show.html.twig', array(
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
'person' => $person,
|
'person' => $person,
|
||||||
//'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,44 +273,4 @@ class ReportController extends Controller
|
|||||||
'delete_form' => $deleteForm->createView(),
|
'delete_form' => $deleteForm->createView(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Deletes a Report entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function deleteAction(Request $request, $id)
|
|
||||||
{
|
|
||||||
$form = $this->createDeleteForm($id);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$entity = $em->getRepository('ChillReportBundle:Report')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find Report entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$em->remove($entity);
|
|
||||||
$em->flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('report'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to delete a Report entity by id.
|
|
||||||
*
|
|
||||||
* @param mixed $id The entity id
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createDeleteForm($id)
|
|
||||||
{
|
|
||||||
return $this->createFormBuilder()
|
|
||||||
->setAction($this->generateUrl('report_delete', array('id' => $id)))
|
|
||||||
->setMethod('DELETE')
|
|
||||||
->add('submit', 'submit', array('label' => 'Delete'))
|
|
||||||
->getForm()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user