wip: integrate with easy admin bundle

This commit is contained in:
Björn Fromme
2026-03-16 12:02:27 +01:00
parent c7702b0c37
commit 99190b0ef1
15 changed files with 478 additions and 3 deletions
@@ -0,0 +1,52 @@
<?php
namespace App\Controller\Admin;
use App\Entity\LogEntry;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\ArrayField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
class LogEntryCrudController extends AbstractCrudController
{
public static function getEntityFqcn(): string
{
return LogEntry::class;
}
public function configureActions(Actions $actions): Actions
{
return $actions
->add(Crud::PAGE_INDEX, Action::DETAIL)
->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)
;
}
public function configureCrud(Crud $crud): Crud
{
return $crud
->setEntityLabelInSingular('Logeintrag')
->setEntityLabelInPlural('Logeinträge')
->setDefaultSort(['createdAt' => 'DESC']);
}
public function configureFields(string $pageName): iterable
{
return [
DateTimeField::new('createdAt', 'Zeitstempel'),
TextField::new('username', 'Benutzer'),
TextField::new('requestId', 'Request ID'),
TextField::new('message', 'Aktion'),
];
}
}