AdminController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 13 1
1
<?php
2
3
/**
4
 * Copyright (c) 2016 Francois-Xavier Soubirou.
5
 *
6
 * This file is part of eco4.
7
 *
8
 * eco4 is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * eco4 is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with eco4. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
declare(strict_types=1);
22
23
namespace AppBundle\Controller\Admin;
24
25
use AppBundle\Entity\Mine;
26
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
27
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
28
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
29
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
30
31
/**
32
 * Default controller class.
33
 *
34
 * @category  Eco4 App
35
 *
36
 * @author    Francois-Xavier Soubirou <[email protected]>
37
 * @copyright 2016 Francois-Xavier Soubirou
38
 * @license   http://www.gnu.org/licenses/   GPLv3
39
 *
40
 * @link      https://www.eco4.io
41
 *
42
 * @Route("/admin")
43
 * @Security("has_role('ROLE_ADMIN')")
44
 */
45
class AdminController extends Controller
46
{
47
    /**
48
     * Default route.
49
     *
50
     * @return Response A Response instance
51
     *
52
     * @Route("/", name="admin")
53
     * @Method("GET")
54
     */
55
    public function indexAction()
56
    {
57
        $engine = $this->get('app.engine');
58
        $engine->refreshAll();
59
60
        $entityManager = $this->getDoctrine()->getManager();
61
        $mines = $entityManager->getRepository(Mine::class)->findAll();
62
63
        return $this->render(
64
            'admin/index.html.twig',
65
            ['mines' => $mines]
66
        );
67
    }
68
}
69