From e9c5a61a21d57b3d14a0ed7beeaaf63f841859e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Noack?= <noack@data-quest.de>
Date: Wed, 20 Apr 2022 15:40:26 +0000
Subject: [PATCH] =?UTF-8?q?Resolve=20#878=20SORM-Konstruktor=20kann=20kein?=
 =?UTF-8?q?en=20unvollst=C3=A4ndigen=20PK=20setzen?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #878
---
 lib/models/SimpleORMap.class.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/models/SimpleORMap.class.php b/lib/models/SimpleORMap.class.php
index 8397fa048d7..cc511381048 100644
--- a/lib/models/SimpleORMap.class.php
+++ b/lib/models/SimpleORMap.class.php
@@ -1192,7 +1192,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
         } else {
             $id = [];
             foreach ($this->pk as $key) {
-                if ($this->content[$key] !== null) {
+                if (array_key_exists($key, $this->content)) {
                     $id[] = $this->content[$key];
                 }
             }
@@ -1782,11 +1782,11 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
     function restore()
     {
         $where_query = $this->getWhereQuery();
+        $id = $this->getId();
         if ($where_query) {
             if ($this->applyCallbacks('before_initialize') === false) {
                 return false;
             }
-            $id = $this->getId();
             $this->initializeContent();
             $query = "SELECT * FROM `{$this->db_table}` WHERE "
                     . join(" AND ", $where_query);
-- 
GitLab