Completed
Pull Request — master (#132)
by
unknown
13:12
created

VenueAdmin::configureListFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 7
nc 1
nop 1
dl 0
loc 12
rs 9.4285
c 1
b 0
f 1
1
<?php
2
3
namespace AppBundle\Admin;
4
5
use Sonata\AdminBundle\Admin\Admin;
6
use Sonata\AdminBundle\Datagrid\ListMapper;
7
use Sonata\AdminBundle\Datagrid\DatagridMapper;
8
use Sonata\AdminBundle\Form\FormMapper;
9
10
class VenueAdmin extends Admin
11
{
12
    protected $baseRouteName = 'AppBundle\Entity\Venue';
13
    protected $baseRoutePattern = 'Venue';
14
    protected $datagridValues = [
15
        '_sort_order' => 'DESC',
16
        '_sort_by'    => 'id',
17
    ];
18
19
    /**
20
     * @param \Sonata\AdminBundle\Form\FormMapper $formMapper
21
     *
22
     * @return void
23
     */
24
    protected function configureFormFields(FormMapper $formMapper)
25
    {
26
        $formMapper
27
            ->add('title')
28
            ->add('address')
29
            ->add('hallTemplate')
30
        ;
31
    }
32
33
    /**
34
     * @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper
35
     *
36
     * @return void
37
     */
38
    protected function configureListFields(ListMapper $listMapper)
39
    {
40
        $listMapper
41
            ->add('title')
42
            ->add('_action', 'actions', [
43
                'actions' => [
44
                    'edit' => [],
45
                    'delete' => [],
46
                ],
47
            ])
48
        ;
49
    }
50
51
    /**
52
     * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
53
     *
54
     * @return void
55
     */
56
    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
57
    {
58
        $datagridMapper
59
            ->add('title')
60
        ;
61
    }
62
}
63