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_values(array_unique(array_merge($parentData[$attributeCode], $value)));
        }
    }
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_values(array_unique(array_merge($parentData[$attributeCode], $value)));
        }
    }
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_values ( array_unique ( array_merge ( $ parentData [ $ attributeCode ] , $ value ) ) ) ; } }
Append data of child products to the parent.

@param array $parentData      Parent product data.
@param array $childAttributes Child product attributes data.

@return void
Append data of child products to the parent .