Allow null on enum properties.
This commit is contained in:
parent
73b7b8f72a
commit
3e27b1b7af
@ -250,7 +250,8 @@ class Model {
|
|||||||
|
|
||||||
foreach ($elem as $key => $value) {
|
foreach ($elem as $key => $value) {
|
||||||
$index = array_search($key, $propertyNames);
|
$index = array_search($key, $propertyNames);
|
||||||
if (is_numeric($index) && enum_exists($properties[$index]->getType()->getName()))
|
if (is_numeric($index) && isset($value) &&
|
||||||
|
enum_exists($properties[$index]->getType()->getName()))
|
||||||
$instance->$key = $properties[$index]->getType()->getName()::tryfrom($value);
|
$instance->$key = $properties[$index]->getType()->getName()::tryfrom($value);
|
||||||
else
|
else
|
||||||
$instance->$key = $value;
|
$instance->$key = $value;
|
||||||
|
Loading…
Reference in New Issue
Block a user