Skip to content

Commit 9ad75ee

Browse files
committed
Default null values are always set
1 parent 93b4104 commit 9ad75ee

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/PHPFUI/ORM/Record.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function __get(string $field) : mixed
135135

136136
if (\class_exists($type))
137137
{
138-
return new $type($this->current[$field . \PHPFUI\ORM::$idSuffix]);
138+
return new $type($this->current[$field . \PHPFUI\ORM::$idSuffix] ?? null);
139139
}
140140
}
141141

@@ -498,10 +498,6 @@ public function setEmpty() : static
498498
{
499499
if (null === $description->defaultValue) // no default value
500500
{
501-
if ($description->nullable) // can be null, so don't set
502-
{
503-
continue;
504-
}
505501
$this->current[$field] = null; // can't be null, so we can set to null, user must set
506502
}
507503
else // has default value, if SQL default, set to null, otherwise default value

0 commit comments

Comments
 (0)