Code Duplication    Length = 12-12 lines in 2 locations

src/SWP/Bundle/TemplateEngineBundle/Controller/ContainerController.php 1 location

@@ 47-58 (lines=12) @@
44
     * @Method("GET")
45
     * @Cache(expires="10 minutes", public=true)
46
     */
47
    public function listAction(Request $request)
48
    {
49
        $entityManager = $this->get('doctrine')->getManager();
50
        $paginator = $this->get('knp_paginator');
51
        $containers = $paginator->paginate($entityManager->getRepository('SWP\Bundle\TemplateEngineBundle\Model\Container')->getAll());
52
53
        if (count($containers) == 0) {
54
            throw new NotFoundHttpException('Containers were not found.');
55
        }
56
57
        return $this->handleView(View::create($this->container->get('swp_pagination_rep')->createRepresentation($containers, $request), 200));
58
    }
59
60
    /**
61
     * Get single container.

src/SWP/Bundle/TemplateEngineBundle/Controller/WidgetController.php 1 location

@@ 42-53 (lines=12) @@
39
     * @Route("/api/{version}/templates/widgtes/", options={"expose"=true}, defaults={"version"="v1"}, name="swp_api_templates_list_widgets")
40
     * @Method("GET")
41
     */
42
    public function listAction(Request $request)
43
    {
44
        $entityManager = $this->get('doctrine')->getManager();
45
        $paginator = $this->get('knp_paginator');
46
        $widgets = $paginator->paginate($entityManager->getRepository('SWP\Bundle\TemplateEngineBundle\Model\Widget')->getAll());
47
48
        if (count($widgets) == 0) {
49
            throw new NotFoundHttpException('Widgets were not found.');
50
        }
51
52
        return $this->handleView(View::create($this->container->get('swp_pagination_rep')->createRepresentation($widgets, $request), 200));
53
    }
54
55
    /**
56
     * Get single widget.