2026-05-17 22:44:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Infrastructure\Http\Controller\Admin;
|
|
|
|
|
|
|
|
|
|
use App\Domain\Log\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\DateTimeField;
|
|
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
|
|
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
2026-05-18 07:48:26 +00:00
|
|
|
use Symfony\Component\Translation\TranslatableMessage;
|
2026-05-17 22:44:03 +00:00
|
|
|
|
|
|
|
|
/** @extends AbstractCrudController<LogEntry> */
|
|
|
|
|
final class LogEntryCrudController extends AbstractCrudController
|
|
|
|
|
{
|
|
|
|
|
public static function getEntityFqcn(): string
|
|
|
|
|
{
|
|
|
|
|
return LogEntry::class;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function configureCrud(Crud $crud): Crud
|
|
|
|
|
{
|
|
|
|
|
return $crud
|
2026-05-18 07:48:26 +00:00
|
|
|
->setEntityLabelInSingular(new TranslatableMessage('crud.log_entry.singular', [], 'admin'))
|
|
|
|
|
->setEntityLabelInPlural(new TranslatableMessage('crud.log_entry.plural', [], 'admin'))
|
2026-05-17 22:44:03 +00:00
|
|
|
->setDefaultSort(['loggedAt' => 'DESC']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function configureActions(Actions $actions): Actions
|
|
|
|
|
{
|
|
|
|
|
return $actions->disable(Action::NEW, Action::EDIT, Action::DELETE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function configureFields(string $pageName): iterable
|
|
|
|
|
{
|
|
|
|
|
yield DateTimeField::new('loggedAt', 'Time');
|
|
|
|
|
yield TextField::new('channel');
|
|
|
|
|
yield IntegerField::new('level');
|
|
|
|
|
yield TextField::new('levelName', 'Level');
|
|
|
|
|
yield TextField::new('message');
|
|
|
|
|
}
|
|
|
|
|
}
|