diff --git a/dbObject.php b/dbObject.php index 29fafdd4..7af2caa0 100644 --- a/dbObject.php +++ b/dbObject.php @@ -527,7 +527,13 @@ private function processAllWith (&$data, $shouldReset = true) { $data[$name] = $this->$name; continue; } - if ($data[$table][$primaryKey] === null) { + $hasOne = false; + foreach ($data[$table] as $field=>$value) { + if ($hasOne === true) continue; + if ($value !== null) $hasOne = true; + } + + if ($hasOne === false) { $data[$name] = null; } else { if ($this->returnType == 'Object') {