Fix PdlStorage Link Handling
Current implementation creates an empty linksMap
object and sets that object on the product. This results in any Json Product that is parsed by the PdoProductStorage class to have no links associated with it. Luckily, links are not widely (i.e., ever) used at this time.
I think inside the for-loop, the linksMap
should be getting updated rather than updating the links
array itself. Otherwise, the implementation is correct.
The idea behind this chunk of code is to map the links
from a list of objects with relation
and uri
keys to a dictionary keyed by relation
pointing to a list of uri
s. For example:
// Input links
links = [
{"relation": "relation_one", "uri": "uri_A_for_relation_one"},
{"relation": "relation_one", "uri": "uri_B_for_relation_one"},
{"relation": "relation_two", "uri": "uri_C_for_relation_two"},
];
// Resulting linksMap
linksMap = {
"relation_one": [
"uri_A_for_relation_one",
"uri_B_for_relation_two",
],
"relation_two": [
"uri_C_for_relation_two",
],
};
// Then set the linksMap on the product