🐛 [BUG] Extending an existing Model throws a typoscript generation error
Describe the bug If you create a Model, that extends an existing Model of another extension and add that in the field "Extend existing model class" and try to save the extension the error pops up "Could not generate typoscript setup".
To Reproduce Steps to reproduce the behavior:
- Create new extension
- Create new Model
- Add extend existing model class to the properties of the Model config
- Save extension and observer error "Extension could not be saved: Could not generate static typoscript, error: PHP Warning: Undefined array key "Koch\KochStsimport\Domain\Model\Fixture" in /var/www/html/public/typo3conf/ext/extension_builder/Classes/Domain/Model/Extension.php line 295"
TYPO3 Version TYPO3 11 (11.0.3) + PHP 8.0
Additional context
I've tracked down the issue to the place here
getClassHierarchy()
If you change the line 295 from this:
if (!is_array($classHierarchy[$parentClass])) {
To this
if (!\array_key_exists($parentClass, $classHierarchy) || !is_array($classHierarchy[$parentClass])) {
Fixes the warning. But it seems the cleaner approach since in the first run through the key $parentClass cannot be set and the access attempt in is_array is therefore causing a PHP warning.