How do I delete an entity from symfony2
Symfony is smart and knows how to make the find() by itself : public function deleteGuestAction(Guest $guest) { if (!$guest) { throw $this->createNotFoundException(‘No guest found’); } $em = $this->getDoctrine()->getEntityManager(); $em->remove($guest); $em->flush(); return $this->redirect($this->generateUrl(‘GuestBundle:Page:viewGuests.html.twig’)); } To send the id in your controller, use {{ path(‘your_route’, {‘id’: guest.id}) }}