Add prefix to the checksum field to prevent mapping conflicts with other fields of the same name in Pimcore classes #280
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.
Currently if you add a field called "checksum" to a Pimcore dataobject class, this will throw the following mapping error:
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"object mapping for [checksum] tried to parse field [checksum] as object, but found a concrete value"}],"type":"mapper_parsing_exception","reason":"object mapping for [checksum] tried to parse field [checksum] as object, but found a concrete value"},"status":400}
This is because the bundle itself has a checksum field being added in with the dataobject data and results in a mapping conflict with the Pimcore class field.
To fix this, I have used the bundle prefix configured by the user to name this checksum field. This prevents such conflicts.
Just like the bundle's database tables, it is always good practice to prefix this kind of things, to prevent conflicts with user developments and customization or even other bundles as well.