From 9a4c3ff7397652374e75f6379c3fccd507c5316f Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+github@gmail.com>
Date: Tue, 18 Jan 2022 14:31:52 +0100
Subject: [PATCH] Revert "throw exceptions when i18nstring is used with a
 composite primary key, fixes #535", re #535

This reverts commit c063caad1a65326d64cfa2aa4a101d6da71f3e3b.
---
 lib/classes/I18NString.php       | 7 +------
 lib/models/SimpleORMap.class.php | 4 ----
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/lib/classes/I18NString.php b/lib/classes/I18NString.php
index da2b5007070..4dc61560454 100644
--- a/lib/classes/I18NString.php
+++ b/lib/classes/I18NString.php
@@ -52,8 +52,7 @@ class I18NString
     {
         $this->base = $base;
         $this->lang = $lang;
-
-        $this->setMetadata($metadata);
+        $this->metadata = $metadata;
     }
 
     /**
@@ -152,10 +151,6 @@ class I18NString
      */
     public function setMetadata($metadata)
     {
-        if (isset($metadata['object_id']) && (is_array($metadata['object_id']) || is_object($metadata['object_id']))) {
-            throw new Exception('Can not use array or object as object id');
-        }
-
         $this->metadata = $metadata;
     }
 
diff --git a/lib/models/SimpleORMap.class.php b/lib/models/SimpleORMap.class.php
index f1708272294..de444aa7c54 100644
--- a/lib/models/SimpleORMap.class.php
+++ b/lib/models/SimpleORMap.class.php
@@ -296,10 +296,6 @@ 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';
             }
-- 
GitLab