Code Duplication    Length = 10-15 lines in 3 locations

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

@@ 31-40 (lines=10) @@
28
    ) {
29
        $template = $configuration->getParameter('template');
30
        
31
        if ($form->isSubmitted() && $form->isValid()) {
32
            $generator = new RouteNameGenerator();
33
    
34
            $url = $this
35
                ->router
36
                ->generate($generator->generate('list', $admin->getName(), $admin->getConfiguration()))
37
            ;
38
39
            return new RedirectResponse($url);
40
        }
41
        
42
        return $this->render($template, [
43
            'admin' => $admin,

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

@@ 65-75 (lines=11) @@
62
            /** @var ClickableInterface $input */
63
            $input = $form->get('save-and-redirect');
64
    
65
            if ($input->isClicked() && $admin->hasAction('list')) {
66
                $generator = new RouteNameGenerator();
67
                
68
                // if the redirect input is clicked and the list action exists, we redirect to the list action
69
                $url = $this
70
                    ->router
71
                    ->generate($generator->generate('list', $admin->getName(), $admin->getConfiguration()))
72
                ;
73
                
74
                return new RedirectResponse($url);
75
            }
76
        }
77
        // display the form after validation or not
78
        $content = $this

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

@@ 66-80 (lines=15) @@
63
            ->getParameter('template')
64
        ;
65
        
66
        if ($form->isValid()) {
67
            // if the form is valid, we save the entity
68
            $admin->save();
69
    
70
            if ($this->shouldRedirect($admin)) {
71
                $generator = new RouteNameGenerator();
72
                
73
                // if the redirect input is clicked and the list action exists, we redirect to the list action
74
                $url = $this
75
                    ->router
76
                    ->generate($generator->generate('list', $admin->getName(), $admin->getConfiguration()));
77
                
78
                return new RedirectResponse($url);
79
            }
80
        }
81
        // display the form after validation or not
82
        $content = $this
83
            ->twig