| @@ 98-109 (lines=12) @@ | ||
| 95 | * @Method("DELETE") |
|
| 96 | * @ParamConverter("district", options={"mapping": {"slug": "slug"}}) |
|
| 97 | */ |
|
| 98 | public function DistrictDeleteAction(Request $request, District $district) |
|
| 99 | { |
|
| 100 | $form = $this->createDeleteForm($district); |
|
| 101 | $form->handleRequest($request); |
|
| 102 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 103 | $entityManager = $this->getDoctrine()->getManager(); |
|
| 104 | ||
| 105 | $entityManager->remove($district); |
|
| 106 | $entityManager->flush(); |
|
| 107 | } |
|
| 108 | return $this->redirectToRoute('admin_districts'); |
|
| 109 | } |
|
| 110 | ||
| 111 | private function createDeleteForm(District $district) |
|
| 112 | { |
|
| @@ 130-141 (lines=12) @@ | ||
| 127 | * @ParamConverter("estate", options={"mapping": {"slug": "slug"}}) |
|
| 128 | ||
| 129 | */ |
|
| 130 | public function estateDeleteAction(Request $request, Estate $estate) |
|
| 131 | { |
|
| 132 | $form = $this->createDeleteForm($estate); |
|
| 133 | $form->handleRequest($request); |
|
| 134 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 135 | $entityManager = $this->getDoctrine()->getManager(); |
|
| 136 | ||
| 137 | $entityManager->remove($estate); |
|
| 138 | $entityManager->flush(); |
|
| 139 | } |
|
| 140 | return $this->redirectToRoute('admin_estates'); |
|
| 141 | } |
|
| 142 | ||
| 143 | private function createDeleteForm(Estate $estate) |
|
| 144 | { |
|