Completed
Pull Request — master (#136)
by
unknown
12:23
created

PerformanceEventAdmin::configureFormFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 1
dl 0
loc 17
ccs 5
cts 5
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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
use Sonata\AdminBundle\Route\RouteCollection;
10
11
class PerformanceEventAdmin extends Admin
12
{
13
    protected $baseRouteName = 'AppBundle\Entity\PerformanceEvent';
14
    protected $baseRoutePattern = 'PerformanceEvent';
15
    protected $datagridValues = [
16
        '_sort_order' => 'DESC',
17
        '_sort_by'    => 'dateTime',
18
    ];
19
20
    /**
21
     * @param RouteCollection $collection
22
     */
23
    protected function configureRoutes(RouteCollection $collection)
24
    {
25
        $collection->add('getVenue');
26 1
    }
27
28
    /**
29 1
     * @param FormMapper $formMapper
30 1
     *
31 1
     * @return void
32 1
     */
33
    protected function configureFormFields(FormMapper $formMapper)
34 1
    {
35
        $formMapper
36
            ->add('performance', 'sonata_type_model')
37
            ->add(
38
                'dateTime',
39
                'sonata_type_datetime_picker',
40 1
                [
41 1
                    'dp_side_by_side'       => true,
42 1
                    'dp_use_current'        => false,
43
                    'dp_use_seconds'        => false,
44
                    'format' => "dd/MM/yyyy HH:mm",
45 1
                ]
46
            )
47
            ->add('venue')
48
        ;
49
    }
50
51
    /**
52 2
     * @param ListMapper $listMapper
53
     *
54
     * @return void
55 2
     */
56 2 View Code Duplication
    protected function configureListFields(ListMapper $listMapper)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
57 2
    {
58 2
        $listMapper
59
            ->add('performance')
60
            ->add('dateTime')
61
            ->add('venue')
62 2
            ->add('_action', 'actions', [
63
                'actions' => [
64
                    'edit' => [],
65 2
                    'delete' => [],
66
                ],
67
            ])
68
        ;
69
    }
70
71
    /**
72 2
     * @param DatagridMapper $datagridMapper
73
     *
74
     * @return void
75 2
     */
76 2
    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
77 2
    {
78 2
        $datagridMapper
79 2
            ->add('performance')
80 2
            ->add('venue')
81
        ;
82 2
    }
83
}
84