AdminController::adminAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 16
ccs 11
cts 11
cp 1
rs 9.4285
cc 1
eloc 11
nc 1
nop 0
crap 1
1
<?php
2
3
namespace AppBundle\Controller\Admin;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
8
9
/**
10
 * Class AdminController
11
 * @package AppBundle\Controller\Admin
12
 */
13
class AdminController extends Controller
14
{
15
    /**
16
     * @Route("/admin", name="admin")
17
     * @Template("@App/admin/admin.html.twig")
18
     */
19 1
    public function adminAction()
20
    {
21 1
        $em = $this->getDoctrine()->getManager();
22
23 1
        $countUsers = $em->getRepository('AppBundle:User')->findCountUsers();
24 1
        $countModules = $em->getRepository('AppBundle:Module')->findCountModules();
25 1
        $countCategories = $em->getRepository('AppBundle:Category')->findCountCategories();
26 1
        $countQuestions = $em->getRepository('AppBundle:Question')->findCountQuestions();
27
28
        return [
29 1
            'count_users' => $countUsers['count_u'],
30 1
            'count_modules' => $countModules['count_m'],
31 1
            'count_categories' => $countCategories['count_c'],
32 1
            'count_questions' => $countQuestions['count_q']
33 1
        ];
34
    }
35
}
36