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

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