diff options
| author | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2022-01-11 12:45:30 +0100 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2022-01-18 08:38:10 +0000 |
| commit | c063caad1a65326d64cfa2aa4a101d6da71f3e3b (patch) | |
| tree | a75920e668eac6b5487839ae81301528e9844c1b /lib/models/SimpleORMap.class.php | |
| parent | e1b4a3b8bc10e18a864bdfa4ba02a30b6da246f4 (diff) | |
throw exceptions when i18nstring is used with a composite primary key, fixes #535
Diffstat (limited to 'lib/models/SimpleORMap.class.php')
| -rw-r--r-- | lib/models/SimpleORMap.class.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/models/SimpleORMap.class.php b/lib/models/SimpleORMap.class.php index de444aa..f170827 100644 --- a/lib/models/SimpleORMap.class.php +++ b/lib/models/SimpleORMap.class.php @@ -296,6 +296,10 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate if (I18N::isEnabled()) { if (isset($config['i18n_fields']) && count($config['i18n_fields']) > 0) { + if (count($config['pk']) > 1) { + throw new Exception('Can not define i18n fields on a composite primary key'); + } + $config['registered_callbacks']['before_store'][] = 'cbI18N'; $config['registered_callbacks']['after_delete'][] = 'cbI18N'; } |
