PlatformLogoAdmin   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 36
c 1
b 0
f 0
dl 0
loc 58
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A configureRoutes() 0 7 1
A configureListFields() 0 14 1
A configureFormFields() 0 2 1
A configureDatagridFilters() 0 9 1
A configureShowFields() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VideoGamesRecords\IgdbBundle\Admin;
6
7
use Sonata\AdminBundle\Admin\AbstractAdmin;
8
use Sonata\AdminBundle\Datagrid\DatagridMapper;
9
use Sonata\AdminBundle\Datagrid\ListMapper;
10
use Sonata\AdminBundle\Form\FormMapper;
11
use Sonata\AdminBundle\Route\RouteCollectionInterface;
12
use Sonata\AdminBundle\Show\ShowMapper;
13
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
14
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
15
use Symfony\Component\Form\Extension\Core\Type\TextType;
16
use VideoGamesRecords\IgdbBundle\Entity\PlatformLogo;
17
18
/**
19
 * @extends AbstractAdmin<PlatformLogo>
20
 */
21
final class PlatformLogoAdmin extends AbstractAdmin
22
{
23
    protected function configureRoutes(RouteCollectionInterface $collection): void
24
    {
25
        $collection
26
            ->remove('create')
27
            ->remove('edit')
28
            ->remove('delete')
29
            ->remove('export');
30
    }
31
32
    protected function configureFormFields(FormMapper $form): void
33
    {
34
        // Read-only admin - no form fields needed as data comes from IGDB API
35
    }
36
37
    protected function configureDatagridFilters(DatagridMapper $filter): void
38
    {
39
        $filter
40
            ->add('id', null, ['label' => 'field.id'])
41
            ->add('imageId', null, ['label' => 'field.platform_logo.image_id'])
42
            ->add('alphaChannel', null, ['label' => 'field.platform_logo.alpha_channel'])
43
            ->add('animated', null, ['label' => 'field.platform_logo.animated'])
44
            ->add('width', null, ['label' => 'field.platform_logo.width'])
45
            ->add('height', null, ['label' => 'field.platform_logo.height']);
46
    }
47
48
    protected function configureListFields(ListMapper $list): void
49
    {
50
        $list
51
            ->add('id', null, ['label' => 'field.id'])
52
            ->add('imageId', null, ['label' => 'field.platform_logo.image_id'])
53
            ->add('width', null, ['label' => 'field.platform_logo.width'])
54
            ->add('height', null, ['label' => 'field.platform_logo.height'])
55
            ->add('alphaChannel', null, ['label' => 'field.platform_logo.alpha_channel'])
56
            ->add('animated', null, ['label' => 'field.platform_logo.animated'])
57
            ->add('createdAt', null, ['label' => 'field.created_at'])
58
            ->add('updatedAt', null, ['label' => 'field.updated_at'])
59
            ->add(ListMapper::NAME_ACTIONS, null, [
60
                'actions' => [
61
                    'show' => ['template' => null],
62
                ],
63
            ]);
64
    }
65
66
    protected function configureShowFields(ShowMapper $show): void
67
    {
68
        $show
69
            ->add('id', null, ['label' => 'field.id'])
70
            ->add('alphaChannel', null, ['label' => 'field.platform_logo.alpha_channel'])
71
            ->add('animated', null, ['label' => 'field.platform_logo.animated'])
72
            ->add('checksum', null, ['label' => 'field.checksum'])
73
            ->add('height', null, ['label' => 'field.platform_logo.height'])
74
            ->add('imageId', null, ['label' => 'field.platform_logo.image_id'])
75
            ->add('url', null, ['label' => 'field.platform_logo.url'])
76
            ->add('width', null, ['label' => 'field.platform_logo.width'])
77
            ->add('createdAt', null, ['label' => 'field.created_at'])
78
            ->add('updatedAt', null, ['label' => 'field.updated_at']);
79
    }
80
}
81