| @@ 214-232 (lines=19) @@ | ||
| 211 | * @Route("/{id}", name="acme_app_jedi_delete") |
|
| 212 | * @Method("DELETE") |
|
| 213 | */ |
|
| 214 | public function deleteAction(Request $request, $id) |
|
| 215 | { |
|
| 216 | $form = $this->createDeleteForm($id); |
|
| 217 | $form->handleRequest($request); |
|
| 218 | ||
| 219 | if ($form->isValid()) { |
|
| 220 | $em = $this->getDoctrine()->getManager(); |
|
| 221 | $entity = $em->getRepository('AcmeAppBundle:Jedi')->find($id); |
|
| 222 | ||
| 223 | if (!$entity) { |
|
| 224 | throw $this->createNotFoundException('Unable to find Jedi entity.'); |
|
| 225 | } |
|
| 226 | ||
| 227 | $em->remove($entity); |
|
| 228 | $em->flush(); |
|
| 229 | } |
|
| 230 | ||
| 231 | return $this->redirect($this->generateUrl('acme_app_jedi_index')); |
|
| 232 | } |
|
| 233 | ||
| 234 | /** |
|
| 235 | * Creates a form to delete a Jedi entity by id. |
|
| @@ 321-339 (lines=19) @@ | ||
| 318 | * |
|
| 319 | * @return \Symfony\Component\HttpFoundation\RedirectResponse |
|
| 320 | */ |
|
| 321 | public function deleteAction(Request $request, $id) |
|
| 322 | { |
|
| 323 | $form = $this->createDeleteForm($id); |
|
| 324 | $form->handleRequest($request); |
|
| 325 | ||
| 326 | if ($form->isValid()) { |
|
| 327 | $em = $this->getDoctrine()->getManager(); |
|
| 328 | $view = $em->getRepository('VictoireBusinessPageBundle:BusinessTemplate')->find($id); |
|
| 329 | ||
| 330 | if (!$view) { |
|
| 331 | throw $this->createNotFoundException('Unable to find BusinessTemplate entity.'); |
|
| 332 | } |
|
| 333 | ||
| 334 | $em->remove($view); |
|
| 335 | $em->flush(); |
|
| 336 | } |
|
| 337 | ||
| 338 | return $this->redirect($this->generateUrl('victoire_business_template_index')); |
|
| 339 | } |
|
| 340 | ||
| 341 | /** |
|
| 342 | * Creates a form to delete a BusinessTemplate entity by id. |
|