We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf1f317 commit c58f414Copy full SHA for c58f414
src/PHPFUI/ORM/Cast.php
@@ -21,9 +21,15 @@ public function setValue(mixed $value, array $parameters) : void
21
{
22
$class = \array_shift($parameters);
23
24
- if (! ($value instanceof $class))
+ if ($value === null)
25
26
- throw new \PHPFUI\ORM\Exception(__METHOD__ . ': Error - ' . \get_debug_type($value) . ' is not an instance of ' . $class);
+ $this->currentRecord[$this->fieldName] = null;
27
+
28
+ return;
29
+ }
30
+ else if (! ($value instanceof $class))
31
+ {
32
+ $value = new $class($value);
33
}
34
35
$this->currentRecord[$this->fieldName] = "{$value}";
0 commit comments