Fixed an exception in type name generator.

This commit is contained in:
Jan Böhmer 2020-03-14 22:14:57 +01:00
parent bc8748e6f4
commit 8ef68fc8d7

View file

@ -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));
}
/**