Fixed some incompatibility on PHP 7.4

This commit is contained in:
Jan Böhmer 2023-01-30 00:43:03 +01:00
parent e0c380d81a
commit 5ead9cbf61
2 changed files with 6 additions and 1 deletions

View file

@ -79,6 +79,10 @@ class CurrencyEntityType extends StructuralEntityType
{ {
$tmp = parent::generateChoiceAttr($choice, $key, $value, $options); $tmp = parent::generateChoiceAttr($choice, $key, $value, $options);
if (!$choice instanceof Currency) {
throw new RuntimeException('The choice must be an instance of '.Currency::class);
}
if(!empty($choice->getIsoCode())) { if(!empty($choice->getIsoCode())) {
$symbol = Currencies::getSymbol($choice->getIsoCode()); $symbol = Currencies::getSymbol($choice->getIsoCode());
} else { } else {

View file

@ -111,8 +111,9 @@ class StructuralDBElementRepository extends NamedDBElementRepository
//See if we already have an element with this name and parent //See if we already have an element with this name and parent
$entity = $this->findOneBy(['name' => $name, 'parent' => $parent]); $entity = $this->findOneBy(['name' => $name, 'parent' => $parent]);
if (null === $entity) { if (null === $entity) {
$class = $this->getClassName();
/** @var AbstractStructuralDBElement $entity */ /** @var AbstractStructuralDBElement $entity */
$entity = new ($this->getClassName()); $entity = new $class;
$entity->setName($name); $entity->setName($name);
$entity->setParent($parent); $entity->setParent($parent);
} }