public function deletePostAction($id) { $em = $this->getDoctrine()->getManager(); $post = $em->getRepository('AppBundle:Post')->find($id); $em->remove($post); $em->flush(); return $this->routeRedirectView('api_v1_get_posts', array(), Response::HTTP_NO_CONTENT); }