Code Duplication    Length = 22-25 lines in 2 locations

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

@@ 91-115 (lines=25) @@
88
     * @Route("/admin/module", name="show_module")
89
     * @Template("@App/admin/module/showmodule.html.twig")
90
     */
91
    public function showModuleAction()
92
    {
93
        $em = $this->getDoctrine()->getManager();
94
95
        $sql = $em->getRepository('AppBundle:Module')
96
            ->findAllModules();
97
        $paginator = $this->get('knp_paginator');
98
        $module = $paginator->paginate(
99
            $sql,
100
            $this->get('request')->query->get('page', 1),
101
            $this->container->getParameter('knp_paginator.page_range')
102
        );
103
104
        $form_delete = [];
105
106
        foreach ($module as $item) {
107
            $form_delete[$item->getId()] = $this->createFormDelete($item->getId())->createView();
108
        }
109
110
        return [
111
            'modules' => $module,
112
            'form_remove' => $form_delete
113
        ];
114
115
    }
116
117
    /**
118
     * @return \Symfony\Component\Form\Form

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

@@ 28-49 (lines=22) @@
25
     * @Method("GET")
26
     * @Template("@App/admin/user/showUser.html.twig")
27
     */
28
    public function indexAction()
29
    {
30
        $em = $this->getDoctrine()->getManager();
31
        $sql = $em->getRepository('AppBundle:User')->findUsersWithoutRole(User::ROLE_ADMIN);
32
        $paginator = $this->get('knp_paginator');
33
        $users = $paginator->paginate(
34
            $sql,
35
            $this->get('request')->query->get('page', 1),
36
            $this->container->getParameter('knp_paginator.page_range')
37
        );
38
39
        $form_delete = [];
40
41
        foreach ($users as $item) {
42
            $form_delete[$item->getId()] = $this->createFormDelete($item->getId())->createView();
43
        }
44
45
        return [
46
            'users' => $users,
47
            'form_remove' => $form_delete
48
        ];
49
    }
50
51
    /**
52
     * Displays a form to edit an existing User entity.