diff --git a/src/Entity/LogSystem/DBElement.php b/src/Entity/LogSystem/DBElement.php deleted file mode 100644 index a4041585..00000000 --- a/src/Entity/LogSystem/DBElement.php +++ /dev/null @@ -1,28 +0,0 @@ -extra['o']; + return (string) ($this->extra['o'] ?? ''); } /** @@ -68,6 +68,6 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry */ public function getNewVersion(): string { - return (string) $this->extra['n']; + return (string) ($this->extra['n'] ?? ''); } } diff --git a/src/Entity/LogSystem/ElementDeletedLogEntry.php b/src/Entity/LogSystem/ElementDeletedLogEntry.php index 53c59c42..9b8a0008 100644 --- a/src/Entity/LogSystem/ElementDeletedLogEntry.php +++ b/src/Entity/LogSystem/ElementDeletedLogEntry.php @@ -61,8 +61,8 @@ class ElementDeletedLogEntry extends AbstractLogEntry return $this; } - public function getOldName(): string + public function getOldName(): ?string { - return $this->extra['n']; + return $this->extra['n'] ?? null; } } diff --git a/src/Entity/LogSystem/ExceptionLogEntry.php b/src/Entity/LogSystem/ExceptionLogEntry.php index 5b36913f..74c35a64 100644 --- a/src/Entity/LogSystem/ExceptionLogEntry.php +++ b/src/Entity/LogSystem/ExceptionLogEntry.php @@ -57,7 +57,7 @@ class ExceptionLogEntry extends AbstractLogEntry */ public function getFile(): string { - return $this->extra['f']; + return $this->extra['f'] ?? 'Unknown file'; } /** @@ -67,7 +67,7 @@ class ExceptionLogEntry extends AbstractLogEntry */ public function getLine(): int { - return $this->extra['l']; + return $this->extra['l'] ?? -1; } /** @@ -77,6 +77,6 @@ class ExceptionLogEntry extends AbstractLogEntry */ public function getMessage(): string { - return $this->extra['m']; + return $this->extra['m'] ?? 'Unknown message'; } } diff --git a/src/Services/LogSystem/LogEntryExtraFormatter.php b/src/Services/LogSystem/LogEntryExtraFormatter.php index c2993422..0141ac19 100644 --- a/src/Services/LogSystem/LogEntryExtraFormatter.php +++ b/src/Services/LogSystem/LogEntryExtraFormatter.php @@ -110,7 +110,7 @@ class LogEntryExtraFormatter return sprintf( '%s: %s', $this->translator->trans('log.element_deleted.old_name'), - $context->getOldName() + $context->getOldName() ?? $this->translator->trans('log.element_deleted.old_name.unknown') ); }