mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Fixed exception in system log.
This commit is contained in:
parent
46772c4ef3
commit
8a7b90d0ea
5 changed files with 8 additions and 36 deletions
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\Entity\LogSystem;
|
||||
|
||||
|
||||
class DBElement
|
||||
{
|
||||
|
||||
}
|
|
@ -58,7 +58,7 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry
|
|||
*/
|
||||
public function getOldVersion(): string
|
||||
{
|
||||
return (string) $this->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'] ?? '');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ class LogEntryExtraFormatter
|
|||
return sprintf(
|
||||
'<i>%s</i>: %s',
|
||||
$this->translator->trans('log.element_deleted.old_name'),
|
||||
$context->getOldName()
|
||||
$context->getOldName() ?? $this->translator->trans('log.element_deleted.old_name.unknown')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue