Import metric property on Sylius
Closed this issue · 1 comments
Thanks to #32 we could now import metrical attributes on Akeneo to Sylius attributes.
Anyway, at the moment the metrical attributes could not be imported as Sylius generic properties.
For example, if I have a metrical attribute 'Weight' on Akeneo I could import it as a weight attribute, but this would be limiting for the reasons that that attribute would be of type text containing the unit measurement and all the logic of shipping rules must be changed to use that attribute instead of the native property of the product. The same for the length, height, and width properties.
A solution could be to edit the GenericPropertyValueHandler to handle the metrical data type, but it could be risky because of the mixed type returned by the getValue method (it must remain compatible with other properties).
So, the solution that seems to be better is adding a MetricPropertyValueHandler that accepts 'attribute_code_on_akeneo' and 'property_path_on_sylius' to map the metric value of the attribute from Akeneo on the property path specified on Sylius. However, this assumes that the value will be imported in the unit of measurement used in Akeneo.
What do you think @webgriffe/wg-devs, @aleho?
I'd go with the MetricPropertyValueHandler. It should normalize all the values to the Akeneo default measurement unit of a given measurement family.