private function addRelationData(&$parentData, $childAttributes, $relation)
{
$childAttributeCodes = array_keys($childAttributes);
$parentAttributeCodes = array_keys($parentData);
if (!isset($parentData['children_attributes'])) {
$parentData['children_attributes'] = [];
}
$childrenAttributes = array_merge($parentData['children_attributes'], array_diff($childAttributeCodes, $this->forbidenChildrenAttributeCode));
if (isset($relation['configurable_attributes']) && !empty($relation['configurable_attributes'])) {
$addedChildrenAttributes = array_diff($childAttributeCodes, $this->forbidenChildrenAttributeCode, $parentAttributeCodes);
$childrenAttributes = array_merge($addedChildrenAttributes, $parentData['children_attributes']);
if (!isset($parentData['configurable_attributes'])) {
$parentData['configurable_attributes'] = [];
}
$configurableAttributesCodes = array_map(function ($attributeId) {
if (isset($this->attributesById[(int) $attributeId])) {
return $this->attributesById[(int) $attributeId]->getAttributeCode();
}
}, $relation['configurable_attributes']);
$parentData['configurable_attributes'] = array_values(array_unique(array_merge($configurableAttributesCodes, $parentData['configurable_attributes'])));
}
$parentData['children_attributes'] = array_values(array_unique($childrenAttributes));
}