Add prefix to the checksum field to prevent mapping conflicts with other fields of the same name in Pimcore classes#280
Open
DanielLaranjeira063 wants to merge 1 commit intopimcore:7.xfrom
Open
Conversation
…d mappings of the same name
Member
|
would we need a update index migration for that change as well? |
Contributor
Author
In my case I only needed to re-save the offending Pimcore class, but it is better to be safe than sorry, so I would say it is best to include one. |
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.
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.