PublicationTypeAdmin   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configureRoutes() 0 12 1
A configureListFields() 0 12 1
1
<?php
2
3
namespace Fenrizbes\PublicationsBundle\Admin;
4
5
use Sonata\AdminBundle\Admin\Admin;
6
use Sonata\AdminBundle\Datagrid\ListMapper;
7
use Sonata\AdminBundle\Route\RouteCollection;
8
use Symfony\Component\Validator\Constraints\Length;
9
10
class PublicationTypeAdmin extends Admin
11
{
12
    protected $baseRouteName    = 'fenrizbes_publication_type';
13
    protected $baseRoutePattern = '/fenrizbes/publication';
14
15
    /**
16
     * {@inheritdoc}
17
     */
18
    protected $datagridValues = array(
19
        '_sort_order' => 'ASC',
20
        '_sort_by'    => 'Title'
21
    );
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected function configureRoutes(RouteCollection $collection)
27
    {
28
        parent::configureRoutes($collection);
29
30
        $collection
31
            ->remove('create')
32
            ->remove('edit')
33
            ->remove('show')
34
            ->remove('export')
35
            ->remove('delete')
36
        ;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    protected function configureListFields(ListMapper $listMapper)
43
    {
44
        $listMapper
45
            ->add('Title', null, array(
46
                'label'    => 'fp.label.admin.publication_type.title',
47
                'template' => 'FenrizbesPublicationsBundle:Admin/PublicationType:list_title.html.twig'
48
            ))
49
            ->add('Key', null, array(
50
                'label' => 'fp.label.admin.publication_type.key'
51
            ))
52
        ;
53
    }
54
}
55