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

@@ 180-189 (lines=10) @@
177
                'attr' => array('class' => "btn btn-primary")
178
            ));
179
180
        if ($request->getMethod() == 'POST') {
181
            $form->handleRequest($request);
182
            if ($form->isValid()) {
183
                $em->persist($comment);
184
                $em->flush();
185
186
                return $this->redirectToRoute('success');
187
            }
188
        }
189
190
        return [
191
            'form' => $form->createView(),
192
        ];