Passed
Push — master ( 5f6dc3...b05beb )
by Andrea
19:20 queued 11s
created

MenuapplicazioneController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Test Coverage

Coverage 98.25%

Importance

Changes 0
Metric Value
eloc 59
dl 0
loc 79
ccs 56
cts 57
cp 0.9825
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
B index() 0 73 3
1
<?php
2
3
namespace Cdf\BiCoreBundle\Controller;
4
5
use Symfony\Component\HttpFoundation\Request;
6
use Symfony\Component\Asset\Packages;
7
use Cdf\BiCoreBundle\Utils\Entity\EntityUtils;
8
use Cdf\BiCoreBundle\Utils\Tabella\ParametriTabella;
9
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
10
11
/**
12
 * Menuapplicazione controller.
13
 */
14
class MenuapplicazioneController extends FiController
15
{
16
17
    /**
18
     * Lists all tables entities.
19
     */
20 1
    public function index(Request $request, Packages $assetsmanager)
21
    {
22 1
        $bundle = $this->getBundle();
23 1
        $controller = $this->getController();
24 1
        $idpassato = $request->get('id');
25
26 1
        if (!$this->getPermessi()->canRead($this->getController())) {
27
            throw new AccessDeniedException('Non si hanno i permessi per visualizzare questo contenuto');
28
        }
29 1
        $crudtemplate = $this->getCrudTemplate($bundle, $controller, $this->getThisFunctionName());
30
31 1
        $entityclassnotation = $this->getEntityClassNotation();
32 1
        $entityclass = $this->getEntityClassName();
33
34 1
        $formclass = str_replace('Entity', 'Form', $entityclass);
35
36 1
        $query = $this->em->createQueryBuilder()
37 1
                ->select('o')
38 1
                ->from('BiCoreBundle:Menuapplicazione', 'o')
39 1
                ->getQuery()
40
        ;
41 1
        $menuobj = $query->getResult();
42 1
        $menus = [];
43 1
        foreach ($menuobj as $menu) {
44 1
            $menus[$menu->getId()] = $menu->getNome();
45
        }
46
47
        $modellocolonne = array(
48 1
            array('nometabella' => $controller,
49 1
                'nomecampo' => "__bicorebundle_Menuapplicazione.id",
50 1
                'etichetta' => 'Id',
51 1
                'ordine' => 0,
52 1
                'larghezza' => 10,
53
                'escluso' => true),
54 1
            array('nometabella' => $controller, 'nomecampo' =>
55 1
                "__bicorebundle_Menuapplicazione.padre", 'etichetta' => 'Padre',
56 1
                'ordine' => 10, 'larghezza' => 10, 'escluso' => false,
57 1
                'decodifiche' => $menus,
58
            ),
59
        );
60
61 1
        $filtri = [];
62 1
        $prefiltri = [];
63 1
        $entityutils = new EntityUtils($this->get('doctrine')->getManager());
0 ignored issues
show
Deprecated Code introduced by
The function Symfony\Bundle\Framework...stractController::get() has been deprecated: since Symfony 5.4, use method or constructor injection in your controller instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

63
        $entityutils = new EntityUtils(/** @scrutinizer ignore-deprecated */ $this->get('doctrine')->getManager());

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
64 1
        $tablenamefromentity = $entityutils->getTableFromEntity($entityclass);
65 1
        $colonneordinamento = [$tablenamefromentity . '.id' => 'DESC'];
66 1
        $parametritabella = ['em' => ParametriTabella::setParameter('default'),
67 1
            'tablename' => ParametriTabella::setParameter($tablenamefromentity),
68 1
            'nomecontroller' => ParametriTabella::setParameter($controller),
69 1
            'bundle' => ParametriTabella::setParameter($bundle),
70 1
            'entityname' => ParametriTabella::setParameter($entityclassnotation),
71 1
            'entityclass' => ParametriTabella::setParameter($entityclass),
72 1
            'formclass' => ParametriTabella::setParameter($formclass),
73 1
            'modellocolonne' => ParametriTabella::setParameter(json_encode($modellocolonne)),
74 1
            'permessi' => ParametriTabella::setParameter(json_encode($this->getPermessi()->toJson($controller))),
75 1
            'urltabella' => ParametriTabella::setParameter($assetsmanager->getUrl('') . $controller . '/' . 'tabella'),
76 1
            'baseurl' => ParametriTabella::setParameter($assetsmanager->getUrl('')),
77 1
            'idpassato' => ParametriTabella::setParameter($idpassato),
78 1
            'titolotabella' => ParametriTabella::setParameter('Elenco ' . $controller),
79 1
            'multiselezione' => ParametriTabella::setParameter('0'),
80 1
            'editinline' => ParametriTabella::setParameter('0'),
81 1
            'paginacorrente' => ParametriTabella::setParameter('1'),
82 1
            'paginetotali' => ParametriTabella::setParameter(''),
83 1
            'righetotali' => ParametriTabella::setParameter('0'),
84 1
            'righeperpagina' => ParametriTabella::setParameter('15'),
85 1
            'estraituttirecords' => ParametriTabella::setParameter('0'),
86 1
            'colonneordinamento' => ParametriTabella::setParameter(json_encode($colonneordinamento)),
87 1
            'filtri' => ParametriTabella::setParameter(json_encode($filtri)),
88 1
            'prefiltri' => ParametriTabella::setParameter(json_encode($prefiltri)),
89 1
            'traduzionefiltri' => ParametriTabella::setParameter(''),
90
        ];
91
92 1
        return $this->render($crudtemplate, ['parametritabella' => $parametritabella]);
93
    }
94
}
95