AdminController::successAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 4
Bugs 0 Features 1
Metric Value
c 4
b 0
f 1
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace AppBundle\Controller\Admin;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
8
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
9
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
10
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
11
use Symfony\Component\HttpFoundation\Request;
12
13
/**
14
 * Class AdminController
15
 * @package AppBundle\Controller\Admin
16
 * @Route("/admin")
17
 */
18
class AdminController extends Controller
19
{
20
    /**
21
     * @Method("GET")
22
     * @Route("/", name="mainAdmin")
23
     * @Template("AppBundle:admin:main.html.twig")
24
     *
25
     * @return Response
26
     */
27 1
    public function indexAction()
28
    {
29 1
        $em = $this->getDoctrine()->getManager();
30 1
        $countArticles = $em->getRepository("AppBundle:Article")
31 1
            ->getCountArticles();
32
33 1
        $countComments = $em->getRepository("AppBundle:Comment")
34 1
            ->getCountComments();
35
36 1
        $countUsers = $em->getRepository("AppBundle:User")
37 1
            ->getCountUsers();
38
39
        return [
40 1
            'countArticles' => $countArticles['countArticles'],
41 1
            'countComments' => $countComments['countComments'],
42 1
            'countUsers'    => $countUsers['countUsers'],
43 1
        ];
44
    }
45
46
    /**
47
     * @Route("/success", name="successAdmin")
48
     * @Template("AppBundle:blog:success.html.twig")
49
     *
50
     * @return Response
51
     */
52
    public function successAction()
53
    {
54
        return [];
55
    }
56
57
}
58