Error saving Localized Fields in Object Bricks with inheritance

Hello all,

we currently have the problem that we get the following error message when saving variants in connection with object bricks and localized fields:


In Localizedfield.php line 444:
                                                           
  [Symfony\Component\Debug\Exception\FatalThrowableError]  
  Call to a member function supportsInheritance() on null   

Exception trace:
  at /var/www/html/vendor/pimcore/pimcore/models/DataObject/Localizedfield.php:444
 Pimcore\Model\DataObject\Localizedfield->getLocalizedValue() at /var/www/html/vendor/pimcore/pimcore/models/DataObject/Localizedfield.php:482
 Pimcore\Model\DataObject\Localizedfield->getLocalizedValue() at /var/www/html/vendor/pimcore/pimcore/models/DataObject/ClassDefinition/Data/Localizedfields.php:1205
 Pimcore\Model\DataObject\ClassDefinition\Data\Localizedfields->getDataForValidity() at /var/www/html/vendor/pimcore/pimcore/models/DataObject/ClassDefinition/Data/Localizedfields.php:1121
 Pimcore\Model\DataObject\ClassDefinition\Data\Localizedfields->checkValidity() at /var/www/html/vendor/pimcore/pimcore/models/DataObject/ClassDefinition/Data/Objectbricks.php:786
 Pimcore\Model\DataObject\ClassDefinition\Data\Objectbricks->checkValidity() at /var/www/html/vendor/pimcore/pimcore/models/DataObject/Concrete.php:127
 Pimcore\Model\DataObject\Concrete->update() at /var/www/html/vendor/pimcore/pimcore/models/DataObject/AbstractObject.php:659
 Pimcore\Model\DataObject\AbstractObject->save() at /var/www/html/vendor/pimcore/pimcore/models/DataObject/Concrete.php:746
 Pimcore\Model\DataObject\Concrete->save() at /var/www/html/src/AppBundle/Command/ProductImport/RediImportCommand.php:90
 AppBundle\Command\ProductImport\RediImportCommand->execute() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:1027
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:97
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:273
 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:83
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:149
 Symfony\Component\Console\Application->run() at /var/www/html/bin/console:26

The problem seems to occur only when we use object bricks with localized fields and want to save a variant of the object that uses this object brick. As soon as we remove the localized fields from the definition of the object brick, the variant can be saved.

I’ve seen that there are already several issues with this problem on GitHub and that the problem should have been fixed some time ago. However, it still occurs in the latest Pimcore version.

Do localized fields in object bricks support inheritance at all? If so, is there a solution for our problem? Are there maybe any migrations that still have to be executed?

Any help would be much appreciated.

Many thanks,
Simon