Skip to content

Instantly share code, notes, and snippets.

@taiebb
Created September 12, 2015 09:11
Show Gist options
  • Save taiebb/34980569ddace666e987 to your computer and use it in GitHub Desktop.
Save taiebb/34980569ddace666e987 to your computer and use it in GitHub Desktop.
public function deleteFromDatatableAction($id) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('NomDuBundle:NomEntite')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Entity.');
}
$em->remove($entity);
$em->flush();
return $this->redirect($this->generateUrl('index'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment