diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2022-09-23 13:45:16 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2022-09-23 13:45:16 +0000 |
| commit | 93fb3b44a2f1f4af9e568041a579fda27fa86e6e (patch) | |
| tree | e459e19985397d327c13f6e4b9c8707d03f65303 /lib/models/ConfigValue.php | |
| parent | d2757abc2500b2ba1c88a69da45a6bf73c451f60 (diff) | |
remove translations after config value was removed, fixes #1597
Closes #1597
Merge request studip/studip!1029
Diffstat (limited to 'lib/models/ConfigValue.php')
| -rw-r--r-- | lib/models/ConfigValue.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/models/ConfigValue.php b/lib/models/ConfigValue.php index 16354ec..4e27ec7 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); } |
