TagAdmin   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 76.92%

Importance

Changes 0
Metric Value
dl 0
loc 58
ccs 10
cts 13
cp 0.7692
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A configureShowFields() 0 6 1
A configureFormFields() 0 6 1
A configureListFields() 0 7 1
A configureDatagridFilters() 0 6 1
1
<?php
2
3
namespace App\Admin;
4
5
use Sonata\AdminBundle\Admin\AbstractAdmin;
6
use Sonata\AdminBundle\Datagrid\ListMapper;
7
use Sonata\AdminBundle\Datagrid\DatagridMapper;
8
use Sonata\AdminBundle\Form\FormMapper;
9
use Sonata\AdminBundle\Show\ShowMapper;
10
11
class TagAdmin extends AbstractAdmin
12
{
13
    protected $baseRouteName = 'App\Entity\Tag';
14
    protected $baseRoutePattern = 'Tag';
15
    protected $datagridValues = [
16
        '_sort_order' => 'ASC',
17
        '_sort_by'    => 'name',
18
    ];
19
20
    /**
21
     * @param \Sonata\AdminBundle\Show\ShowMapper $showMapper
22
     *
23
     * @return void
24
     */
25
    protected function configureShowFields(ShowMapper $showMapper)
26
    {
27
        $showMapper
28
            ->add('title')
29
        ;
30
    }
31
32
    /**
33
     * @param \Sonata\AdminBundle\Form\FormMapper $formMapper
34
     *
35
     * @return void
36
     */
37 2
    protected function configureFormFields(FormMapper $formMapper)
38
    {
39
        $formMapper
40 2
            ->add('title')
41
        ;
42 2
    }
43
44
    /**
45
     * @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper
46
     *
47
     * @return void
48
     */
49 2
    protected function configureListFields(ListMapper $listMapper)
50
    {
51
        $listMapper
52 2
            ->addIdentifier('title')
53 2
            ->add('posts')
54
        ;
55 2
    }
56
57
    /**
58
     * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
59
     *
60
     * @return void
61
     */
62 2
    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
63
    {
64
        $datagridMapper
65 2
            ->add('title')
66
        ;
67 2
    }
68
}
69