Code Duplication    Length = 11-13 lines in 3 locations

src/AppBundle/Controller/Admin/AdminCommentController.php 1 location

@@ 75-87 (lines=13) @@
72
     * @Security("has_role('ROLE_ADMIN')")
73
     * @ParamConverter("comment", options={"mapping": {"id": "id"}})
74
     */
75
    public function deleteCommentAction(Request $request, Comment $comment)
76
    {
77
        //$comments = $this->getDoctrine()->getRepository('AppBundle:Comment')->getDisabledComments();
78
79
        $form = $this->deleteForm($comment);
80
        $form->handleRequest($request);
81
        if ($form->isSubmitted() && $form->isValid()) {
82
            $entityManager = $this->getDoctrine()->getManager();
83
            $entityManager->remove($comment);
84
            $entityManager->flush();
85
        }
86
        return $this->redirectToRoute('admin_comments');
87
    }
88
89
    private function deleteForm(Comment $comment)
90
    {

src/AppBundle/Controller/Admin/AdminDistrictController.php 1 location

@@ 102-113 (lines=12) @@
99
     * @Security("has_role('ROLE_ADMIN')")
100
     * @ParamConverter("district", options={"mapping": {"slug": "slug"}})
101
     */
102
    public function DistrictDeleteAction(Request $request, District $district)
103
    {
104
        $form = $this->createDeleteForm($district);
105
        $form->handleRequest($request);
106
        if ($form->isSubmitted() && $form->isValid()) {
107
            $entityManager = $this->getDoctrine()->getManager();
108
109
            $entityManager->remove($district);
110
            $entityManager->flush();
111
        }
112
        return $this->redirectToRoute('admin_districts');
113
    }
114
115
    private function createDeleteForm(District $district)
116
    {

src/AppBundle/Controller/Admin/AdminEstateController.php 1 location

@@ 130-140 (lines=11) @@
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
            $entityManager->remove($estate);
137
            $entityManager->flush();
138
        }
139
        return $this->redirectToRoute('admin_estates');
140
    }
141
142
    private function createDeleteForm(Estate $estate)
143
    {