AdminBlock   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 44
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configureRoutes() 0 4 1
A configureListFields() 0 22 1
1
<?php
2
3
namespace Alpixel\Bundle\CMSBundle\Admin;
4
5
use Sonata\AdminBundle\Datagrid\ListMapper;
6
use Sonata\AdminBundle\Route\RouteCollection;
7
8
class AdminBlock extends BaseBlockEntityAdmin
9
{
10
    protected $baseRouteName = 'alpixel_admin_cms_block';
11
    protected $baseRoutePattern = 'block';
12
13
    protected $datagridValues = [
14
        '_page'       => 1,
15
        '_sort_order' => 'DESC',
16
        '_sort_by'    => 'dateUpdated',
17
    ];
18
19
    protected function configureRoutes(RouteCollection $collection)
20
    {
21
        $collection->clearExcept(['list', 'edit']);
22
    }
23
24
    /**
25
     * @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper
26
     *
27
     * @return void
28
     */
29
    protected function configureListFields(ListMapper $listMapper)
30
    {
31
        $listMapper
32
            ->add('id')
33
            ->add('locale', null, [
34
                'label' => 'Langue',
35
            ])
36
            ->add('name', null, [
37
                'label' => 'Nom',
38
            ])
39
            ->add('dateCreated', null, [
40
                'label' => 'Date de création',
41
            ])
42
            ->add('dateUpdated', null, [
43
                'label' => 'Date d\'édition',
44
            ])
45
            ->add('_action', 'actions', [
46
                'actions' => [
47
                    'edit' => ['template' => 'AlpixelCMSBundle:admin:fields/list__block_action_edit.html.twig'],
48
                ],
49
            ]);
50
    }
51
}
52