Refactoring virtual categories rules storage/reading. #863
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.
What is done in this PR :
moving from serialized data to JSON as required by Magento best practices : http://devdocs.magento.com/guides/v2.2/ext-best-practices/tutorials/serialized-to-json-data-upgrade.html
not relying on the attribute backend model for read/save operation : this was causing problem when uninstalling the module.
I did choose to not migrate completely to an "externalized" extension attribute because it would have implied to create a new table to store the rules, to migrate the values, to deprecate everything relying on
$category->getVirtualRule
and would have cause backward compatibility changes.So for now, this is still a category attribute, but without any custom backend model, allowing users to disable the module without experiencing issues.
I thought this was a rather acceptable solution for now. We'll be able to go further on a next iteration if needed.
Regards