Code Duplication    Length = 18-19 lines in 2 locations

src/LAG/AdminBundle/Action/Responder/EditResponder.php 1 location

@@ 34-51 (lines=18) @@
31
        // if the form is submitted and validated, the user should be redirected
32
        if ($form->isSubmitted() && $form->isValid()) {
33
            // if the save button is pressed, the user will stay on the edit view
34
            if ('save' === $submitButtonName) {
35
                $url = $this
36
                    ->router
37
                    ->generate($admin->generateRouteName('edit'), [
38
                        'id' => $admin->getUniqueEntity()->getId(),
39
                    ])
40
                ;
41
                
42
                return new RedirectResponse($url);
43
            } else {
44
                // otherwise the user will be redirected to the list view
45
                $url = $this
46
                    ->router
47
                    ->generate($admin->generateRouteName('list'))
48
                ;
49
                
50
                return new RedirectResponse($url);
51
            }
52
        }
53
        
54
        return $this->render($template, [

src/LAG/AdminBundle/Form/Handler/DeleteFormHandler.php 1 location

@@ 35-53 (lines=19) @@
32
     */
33
    public function handle(FormInterface $form, AdminInterface $admin)
34
    {
35
        if ($form->isValid()) {
36
            // remove the current entity
37
            $admin->remove();
38
            
39
            // redirect to list if the action exist
40
            $allowedActions = $admin
41
                ->getConfiguration()
42
                ->getParameter('actions')
43
            ;
44
    
45
            if (array_key_exists('list', $allowedActions)) {
46
                $url = $this
47
                    ->router
48
                    ->generate($admin->generateRouteName('list'));
49
                
50
                return new RedirectResponse($url);
51
            }
52
            return new RedirectResponse('/');
53
        }
54
        $url = $this
55
            ->router
56
            ->generate($admin->generateRouteName('delete'))