From 8ef68fc8d7d1e3b26b9e4e840273784a9e1bf591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 14 Mar 2020 22:14:57 +0100 Subject: [PATCH] Fixed an exception in type name generator. --- src/Services/ElementTypeNameGenerator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Services/ElementTypeNameGenerator.php b/src/Services/ElementTypeNameGenerator.php index 319d504d..087e7265 100644 --- a/src/Services/ElementTypeNameGenerator.php +++ b/src/Services/ElementTypeNameGenerator.php @@ -48,6 +48,7 @@ use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractNamedDBElement; use App\Entity\Contracts\NamedElementInterface; use App\Entity\Devices\Device; +use App\Entity\Parameters\AbstractParameter; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; use App\Entity\Parts\Manufacturer; @@ -92,6 +93,7 @@ class ElementTypeNameGenerator Pricedetail::class => $this->translator->trans('pricedetail.label'), Group::class => $this->translator->trans('group.label'), User::class => $this->translator->trans('user.label'), + AbstractParameter::class => $this->translator->trans('parameter.label') ]; } @@ -124,7 +126,7 @@ class ElementTypeNameGenerator } //When nothing was found throw an exception - throw new EntityNotSupportedException(sprintf('No localized label for the element with type %s was found!', get_class($entity))); + throw new EntityNotSupportedException(sprintf('No localized label for the element with type %s was found!', is_object($entity) ? get_class($entity) : (string) $entity)); } /**