Repository navigation
Keep the values of an existing object for missing fields - #232
Open
DavidBadura wants to merge 1 commit into
Open
DavidBadura wants to merge 1 commit into
DavidBadura wants to merge 1 commit into
Conversation
|
Hello 👋 Here are the most recent benchmark results, compared against GeneratedHydrator
StackHydrator
StackHydratorWithLazy
StackHydratorWithCryptography
GeneratedHydratorWithCryptography
This comment gets updated every time a new commit comes in. |
DavidBadura
force-pushed
the
populate-without-defaults
branch
from
October 18, 2026 17:48
b756ea4 to
625c869
Compare
Hydrating with OBJECT_TO_POPULATE set promoted properties to their default value if their field was missing, so an update overwrote values which were not part of the data. Defaults are now only used for new objects. The generated mappers get an own populate path for classes with promoted defaults, so the code for new objects stays the same.
DavidBadura
force-pushed
the
populate-without-defaults
branch
from
October 19, 2026 06:05
625c869 to
ee9bd6c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hydrating an existing object with
Hydrator::OBJECT_TO_POPULATEset promoted properties to their default value if their field was missing in the data. Updating only the name of a profile therefore also reset every other promoted property with a default. Defaults are now only used for new objects, missing fields keep the current value of the object.The
ReflectionMapperskips missing fields for existing objects. The generated mappers get a separatepopulate()path without the defaults, but only for classes with promoted defaults, so the code for new objects and the nested entry points stays the same. The upgrade guide mentions the changed behaviour.This came up while porting the groups extension (#231): properties outside the selected groups must not be reset either when an object is populated.