/** * Handle standard delete (no modal) * * @param Request $request * @param ContentAdmin $admin * @param $entity * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response */ public function delete(Request $request, ContentAdmin $admin, $entity) { if ($entity === null) { return $this->renderError('error.content.notfound', 404); } if ($request->isMethod('post')) { try { $admin->deleteEntity($entity); $this->buildEntityFlash('success', 'content.delete.flash.success', $admin, $entity); } catch (\Exception $e) { $this->buildEntityFlash('error', 'content.delete.flash.error', $admin, $entity); $this->get('logger')->addError($e->getMessage()); } return $this->redirect($this->getRoutingHelper()->generateUrl($admin, 'index')); } return $this->render('LeaptAdminBundle:' . StringUtil::camelize($admin->getAlias()) . ':modalDelete.html.twig', array('admin' => $admin, 'entity' => $entity)); }