diff --git a/lib/models/ConfigValue.php b/lib/models/ConfigValue.php index 16354ec796d8a7a4b1975a4bb14a5361690814f3..4e27ec7843c254ed72ca1a3f0e4c9bd4b75d90e7 100644 --- a/lib/models/ConfigValue.php +++ b/lib/models/ConfigValue.php @@ -26,10 +26,18 @@ class ConfigValue extends SimpleORMap protected static function configure($config = []) { $config['db_table'] = 'config_values'; + $config['belongs_to']['entry'] = [ 'class_name' => \ConfigEntry::class, 'foreign_key' => 'field', ]; + + $config['registered_callbacks']['after_delete'][] = function (ConfigValue $value) { + if ($value->entry->type === 'i18n') { + $value->getTypedValue()->removeTranslations(); + } + }; + parent::configure($config); }