Code Duplication    Length = 9-10 lines in 2 locations

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

@@ 124-132 (lines=9) @@
121
        ])
122
            ->add('save', SubmitType::class, array('label' => 'Save'));
123
124
        if ($request->getMethod() == 'POST') {
125
            $form->handleRequest($request);
126
            if ($form->isValid()) {
127
                $em->persist($comment);
128
                $em->flush();
129
130
                return $this->redirectToRoute('commentsAdmin');
131
            }
132
        }
133
134
        return [
135
            'title' => $title,

src/AppBundle/Controller/Blog/BlogController.php 1 location

@@ 154-163 (lines=10) @@
151
                'attr' => array('class' => "btn btn-primary")
152
            ));
153
154
        if ($request->getMethod() == 'POST') {
155
            $form->handleRequest($request);
156
            if ($form->isValid()) {
157
                $em->persist($comment);
158
                $em->flush();
159
160
//                return $this->redirectToRoute('showArticle', ['slug' => $slug]);
161
                return $this->redirectToRoute('success');
162
            }
163
        }
164
165
        return [
166
            'form' => $form->createView(),