- Added a new initialized variable checking before adding (or not) a new value to an entity
This commit is contained in:
parent
0e0f004bc1
commit
5d6d7ff49c
@ -51,9 +51,12 @@ abstract class Save implements \Picea\Ui\Method\FormInterface {
|
||||
));
|
||||
}
|
||||
}
|
||||
catch(\Throwable $ex) {
|
||||
catch(\PDOException $ex) {
|
||||
throw new \PDOException($this->lang('lean.api.form.save.error.pdo', [ 'error' => $ex->getMessage() ]));
|
||||
}
|
||||
catch(\Throwable $ex) {
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
return $saved;
|
||||
}
|
||||
@ -69,7 +72,8 @@ abstract class Save implements \Picea\Ui\Method\FormInterface {
|
||||
|
||||
if ($apiField) {
|
||||
$var = $apiField->field ?: $key;
|
||||
if ( isset($context->{$var}) ) {
|
||||
|
||||
if ( property_exists($context, $var) && ( new \ReflectionProperty($context, $var) )->isInitialized($context) ) {
|
||||
if ($apiField->setterMethod) {
|
||||
# Use a setter method
|
||||
call_user_func([ $entity, $apiField->setterMethod ], $context->{$var});
|
||||
|
Loading…
x
Reference in New Issue
Block a user