aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/Model.php
diff options
context:
space:
mode:
Diffstat (limited to 'Digitigrade/Model.php')
-rw-r--r--Digitigrade/Model.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/Digitigrade/Model.php b/Digitigrade/Model.php
index b5c9e99..a065154 100644
--- a/Digitigrade/Model.php
+++ b/Digitigrade/Model.php
@@ -71,6 +71,10 @@ abstract class Model {
} elseif (is_array($value)) {
// arrays ought to be handled separately when saving (different db table)
$discarded = true;
+ } elseif ($value == null && $pName == 'id') {
+ // don't overwrite an existing primary key with null ..
+ // this is kinda janky but it hopefully will work
+ $discarded = true;
}
if (!$discarded)
$result[self::mangleName($pName)] = $value;