PublicationTypeAdmin::configureRoutes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 12
rs 9.4286
cc 1
eloc 8
nc 1
nop 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