-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSiteCrudController.php
More file actions
91 lines (80 loc) · 3 KB
/
Copy pathSiteCrudController.php
File metadata and controls
91 lines (80 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
declare(strict_types=1);
namespace App\Controller\Admin;
use App\Admin\Field\AdvisoryCountField;
use App\Admin\Field\ConfigFilePathField;
use App\Admin\Field\DomainField;
use App\Admin\Field\RootDirField;
use App\Admin\Field\ServerTypeField;
use App\Admin\Field\SiteTypeField;
use App\Admin\Field\VersionField;
use App\Entity\Site;
use App\Form\Type\Admin\SemverFilter;
use App\Trait\ExportCrudControllerTrait;
use App\Trait\SemverSortableCrudControllerTrait;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\Filters;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
class SiteCrudController extends AbstractCrudController
{
use ExportCrudControllerTrait;
use SemverSortableCrudControllerTrait;
public function __construct()
{
}
public static function getEntityFqcn(): string
{
return Site::class;
}
#[\Override]
public function configureCrud(Crud $crud): Crud
{
return $crud->showEntityActionsInlined();
}
#[\Override]
public function configureActions(Actions $actions): Actions
{
return $actions
->add(Crud::PAGE_INDEX, Action::DETAIL)
->add(Crud::PAGE_INDEX, $this->createExportAction())
->remove(Crud::PAGE_INDEX, Action::NEW)
->remove(Crud::PAGE_INDEX, Action::EDIT)
->remove(Crud::PAGE_INDEX, Action::DELETE)
->remove(Crud::PAGE_DETAIL, Action::EDIT)
->remove(Crud::PAGE_DETAIL, Action::DELETE);
}
#[\Override]
public function configureFields(string $pageName): iterable
{
yield DomainField::new('primaryDomain')->setColumns(12);
yield AdvisoryCountField::new('advisoryCount')->setLabel('Adv.');
yield AssociationField::new('domains')->hideOnIndex();
yield SiteTypeField::new('type')->setLabel('Stack');
yield ConfigFilePathField::new('configFilePath')->setColumns(12)->hideOnIndex();
yield RootDirField::new('rootDir')->setColumns(12)->hideOnIndex();
yield VersionField::new('phpVersion')->setLabel('PHP');
yield AssociationField::new('installation')->hideOnIndex();
yield ServerTypeField::new('server.type')->setLabel('Type');
yield AssociationField::new('server');
yield AssociationField::new('detectionResult')->hideOnIndex();
yield DateTimeField::new('createdAt')->hideOnIndex();
}
#[\Override]
public function configureFilters(Filters $filters): Filters
{
return $filters
->add('primaryDomain')
->add('configFilePath')
->add(SemverFilter::new('phpVersion', 'PHP'))
->add('server');
}
#[\Override]
protected function semverSortedProperties(): array
{
return ['phpVersion'];
}
}