Smile\ElasticsuiteCatalog\Model\Product\Indexer\Fulltext\Datasource\AttributeData::addChildData PHP Method

addChildData() private method

Append data of child products to the parent.
private addChildData ( array &$parentData, array $childAttributes ) : void
$parentData array Parent product data.
$childAttributes array Child product attributes data.
return void
    private function addChildData(&$parentData, $childAttributes)
    {
        $authorizedChildAttributes = $parentData['children_attributes'];
        $addedChildAttributesData = array_filter($childAttributes, function ($attributeCode) use($authorizedChildAttributes) {
            return in_array($attributeCode, $authorizedChildAttributes);
        }, ARRAY_FILTER_USE_KEY);
        foreach ($addedChildAttributesData as $attributeCode => $value) {
            if (!isset($parentData[$attributeCode])) {
                $parentData[$attributeCode] = [];
            }
            $parentData[$attributeCode] = array_unique(array_merge($parentData[$attributeCode], $value));
        }
    }