You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using <embed-one ... nullable="true"/>, hydration fails due to a missing nullable check in the generated hydrator.
Current behavior
When using <embed-one ... nullable="true"/> in combination with typed, uninitialized properties, then these properties are not correctly initialized to null. This works for regular fields due to the following generated condition in the hydrator:
if (isset($data['theField']) || (! empty($this->class->fieldMappings['theField']['nullable']) && array_key_exists('theField', $data))) {
For embedded fields, however, the following condition is generated:
if (isset($data['theField'])) {
As you can see, the check for the nullable property is missing, hence the field is not initialized.
Thanks for the report. I've taken a crack at fixing this in #2302. As shown in the tests, you can set a default value on the property as a workaround until we have a release:
Bug Report
Summary
When using
<embed-one ... nullable="true"/>
, hydration fails due to a missing nullable check in the generated hydrator.Current behavior
When using
<embed-one ... nullable="true"/>
in combination with typed, uninitialized properties, then these properties are not correctly initialized tonull
. This works for regular fields due to the following generated condition in the hydrator:For embedded fields, however, the following condition is generated:
As you can see, the check for the
nullable
property is missing, hence the field is not initialized.How to reproduce
Expected behavior
The text was updated successfully, but these errors were encountered: