feat: error-codes in flash messages to reference log entries

This commit is contained in:
Björn Fromme committed 2026-03-16 12:02:59 +01:00
1 parent 21a3e8fafc
commit afe5aef9f7
7 files changed
+517

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace App\Twig;
use App\Service\ErrorCodeService;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
class ErrorCodeExtension extends AbstractExtension
{
public function __construct(
private readonly ErrorCodeService $errorCodeService,
) {
}
public function getFunctions(): array
{
return [
new TwigFunction('error_code', [$this, 'getErrorCode']),
new TwigFunction('has_error_code', [$this, 'hasErrorCode']),
];
}
public function getErrorCode(): ?string
{
return $this->errorCodeService->getErrorCode();
}
public function hasErrorCode(): bool
{
return $this->errorCodeService->hasError();
}
}