Skip to content
Snippets Groups Projects
Commit e9c5a61a authored by André Noack's avatar André Noack
Browse files

Resolve #878 SORM-Konstruktor kann keinen unvollständigen PK setzen

Closes #878
parent 180a7962
No related branches found
No related tags found
No related merge requests found
...@@ -1192,7 +1192,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate ...@@ -1192,7 +1192,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
} else { } else {
$id = []; $id = [];
foreach ($this->pk as $key) { foreach ($this->pk as $key) {
if ($this->content[$key] !== null) { if (array_key_exists($key, $this->content)) {
$id[] = $this->content[$key]; $id[] = $this->content[$key];
} }
} }
...@@ -1782,11 +1782,11 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate ...@@ -1782,11 +1782,11 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
function restore() function restore()
{ {
$where_query = $this->getWhereQuery(); $where_query = $this->getWhereQuery();
$id = $this->getId();
if ($where_query) { if ($where_query) {
if ($this->applyCallbacks('before_initialize') === false) { if ($this->applyCallbacks('before_initialize') === false) {
return false; return false;
} }
$id = $this->getId();
$this->initializeContent(); $this->initializeContent();
$query = "SELECT * FROM `{$this->db_table}` WHERE " $query = "SELECT * FROM `{$this->db_table}` WHERE "
. join(" AND ", $where_query); . join(" AND ", $where_query);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment