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
This service also executes an SQL query and hydrates the data once in the DTO
But I have a problem with nullable properties, indeed the hydrator will hydrate the null value for these properties, if they are not present in the data array.
I am able to correct the problem by modifying the HydratorMethodsVisitor class at line 110 by replacing return ['$ object->'. $ propertyName. '='. $ inputArrayName. '['. $ escapedName. '] ?? null; '];
by return ['$ object->'. $ propertyName. '='. $ inputArrayName. '['. $ escapedName. '] ?? '. '$ object->'. $ propertyName. ' ?? null; '];
So my question is, shouldn't the hydrator only hydrate properties if it exists in the array, like Laminas Hydrator ?
Should I use my own FileWriterGeneratorStrategy to overcome this problem ?
Thanks
The text was updated successfully, but these errors were encountered:
Hello,
Here is how I use this hydrator
But I have a problem with nullable properties, indeed the hydrator will hydrate the null value for these properties, if they are not present in the data array.
I am able to correct the problem by modifying the HydratorMethodsVisitor class at line 110 by replacing
return ['$ object->'. $ propertyName. '='. $ inputArrayName. '['. $ escapedName. '] ?? null; '];
by
return ['$ object->'. $ propertyName. '='. $ inputArrayName. '['. $ escapedName. '] ?? '. '$ object->'. $ propertyName. ' ?? null; '];
So my question is, shouldn't the hydrator only hydrate properties if it exists in the array, like Laminas Hydrator ?
Should I use my own FileWriterGeneratorStrategy to overcome this problem ?
Thanks
The text was updated successfully, but these errors were encountered: