|
@@ -128,19 +128,20 @@ abstract class LuDbo implements \JsonSerializable {
|
128
|
128
|
$doc = $parser->parse();
|
129
|
129
|
$type = is_null($doc) ? null : $doc->getType();
|
130
|
130
|
|
|
131
|
+ $value = null;
|
131
|
132
|
if (isset($json[$name])) {
|
132
|
133
|
$value = static::deserializeValue($json[$name], $type);
|
133
|
134
|
$property->setAccessible(true);
|
134
|
135
|
$property->setValue($dbo, $value);
|
135
|
|
-
|
136
|
|
- if ($doc->isNotNull() && is_null($value)) {
|
137
|
|
- throw new LuDboConstraintException("Field '" . $name . "' can not be null");
|
138
|
|
- }
|
|
136
|
+ }
|
139
|
137
|
|
140
|
|
- if (!is_null($doc) && !is_null($value)) {
|
141
|
|
- foreach ($doc->getConstraints() as $constraint) {
|
142
|
|
- call_user_func_array([$value, $constraint->getMethod()], $constraint->getArguments());
|
143
|
|
- }
|
|
138
|
+ if ($doc->isNotNull() && is_null($value)) {
|
|
139
|
+ throw new LuDboConstraintException("Field '" . $name . "' can not be null");
|
|
140
|
+ }
|
|
141
|
+
|
|
142
|
+ if (!is_null($doc) && !is_null($value)) {
|
|
143
|
+ foreach ($doc->getConstraints() as $constraint) {
|
|
144
|
+ call_user_func_array([$value, $constraint->getMethod()], $constraint->getArguments());
|
144
|
145
|
}
|
145
|
146
|
}
|
146
|
147
|
}
|