linkToCrudAction('xmlDumps') ->displayIf(static fn (LogEntry $entity): bool => 'bpn' === $entity->getChannel()); return $actions ->add(Crud::PAGE_INDEX, Action::DETAIL) ->add(Crud::PAGE_INDEX, $viewDumps) ->add(Crud::PAGE_DETAIL, $viewDumps) ->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']) ->setSearchFields(['errorCode', 'message', 'channel', 'extra']); } public function configureFields(string $pageName): iterable { yield DateTimeField::new('createdAt', 'Zeitstempel'); yield TextField::new('errorCode', 'Fehlercode') ->formatValue(static fn (?string $value): string => $value ?? '-'); yield TextField::new('username', 'Benutzer'); yield TextField::new('message', 'Aktion'); yield TextField::new('requestId', 'Request ID'); yield TextField::new('uri', 'URI'); yield JsonDataField::new('context', 'Kontext')->onlyOnDetail(); yield JsonDataField::new('extra', 'Extra')->onlyOnDetail(); } public function xmlDumps(Request $request, XmlDumpService $xmlDumpService): Response { $entityId = $request->query->getInt('entityId'); if ($entityId <= 0) { throw $this->createNotFoundException('Log entry not found.'); } $entity = $this->logEntryRepository->find($entityId); if (!$entity instanceof LogEntry) { throw $this->createNotFoundException('Log entry not found.'); } $dumps = []; try { $dumps = $xmlDumpService->findDumpsForRequestId($entity->getRequestId()); } catch (FilesystemException) { } return $this->render('admin/xml_dump/list.html.twig', [ 'logEntry' => $entity, 'requestId' => $entity->getRequestId(), 'dumps' => $dumps, ]); } }