SongAdmin::configureFormFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace PHPDish\DailySongPlugin\Admin;
4
5
use Sonata\AdminBundle\Admin\AbstractAdmin;
0 ignored issues
show
Bug introduced by
The type Sonata\AdminBundle\Admin\AbstractAdmin was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Sonata\AdminBundle\Datagrid\DatagridMapper;
0 ignored issues
show
Bug introduced by
The type Sonata\AdminBundle\Datagrid\DatagridMapper was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Sonata\AdminBundle\Datagrid\ListMapper;
0 ignored issues
show
Bug introduced by
The type Sonata\AdminBundle\Datagrid\ListMapper was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Sonata\AdminBundle\Form\FormMapper;
0 ignored issues
show
Bug introduced by
The type Sonata\AdminBundle\Form\FormMapper was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
class SongAdmin extends AbstractAdmin
11
{
12
    protected function configureDatagridFilters(DatagridMapper $filter)
13
    {
14
        $filter
15
            ->add('name', null);
16
    }
17
18
    protected function configureListFields(ListMapper $list)
19
    {
20
        $list
21
            ->addIdentifier('name', null, ['label' => '标题'])
22
            ->add('src', null, ['label' => 'URL'])
23
            ->add('srcId', null, ['label' => '歌曲ID'])
24
            ->add('enabled', null, ['editable' => true, 'label' => '状态']);
25
    }
26
27
    protected function configureFormFields(FormMapper $form)
28
    {
29
        $form
30
            ->add('name', null, ['label' => '标题'])
31
            ->add('src', null, ['label' => 'URL'])
32
            ->add('srcId', null, ['label' => '歌曲ID'])
33
            ->add('enabled', null, ['label' => '状态']);
34
    }
35
}