public function addData($storeId, array $indexData)
    {
        $categoryData = $this->resourceModel->loadCategoryData($storeId, array_keys($indexData));

        foreach ($categoryData as $categoryDataRow) {
            $productId = (int) $categoryDataRow['product_id'];
            unset($categoryDataRow['product_id']);

            $categoryDataRow = array_merge(
                $categoryDataRow,
                [
                    'category_id' => (int) $categoryDataRow['category_id'],
                    'is_parent'   => (bool) $categoryDataRow['is_parent'],
                    'name'        => (string) $categoryDataRow['name'],
                ]
            );

            if (isset($categoryDataRow['position']) && $categoryDataRow['position'] !== null) {
                $categoryDataRow['position'] = (int) $categoryDataRow['position'];
            }

            if (isset($categoryDataRow['is_blacklisted'])) {
                $categoryDataRow['is_blacklisted'] = (bool) $categoryDataRow['is_blacklisted'];
            }

            $indexData[$productId]['category'][] = array_filter($categoryDataRow);
        }

        return $indexData;
    }
public function addData($storeId, array $indexData)
    {
        $categoryData = $this->resourceModel->loadCategoryData($storeId, array_keys($indexData));

        foreach ($categoryData as $categoryDataRow) {
            $productId = (int) $categoryDataRow['product_id'];
            unset($categoryDataRow['product_id']);

            $categoryDataRow = array_merge(
                $categoryDataRow,
                [
                    'category_id' => (int) $categoryDataRow['category_id'],
                    'is_parent'   => (bool) $categoryDataRow['is_parent'],
                    'name'        => (string) $categoryDataRow['name'],
                ]
            );

            if (isset($categoryDataRow['position']) && $categoryDataRow['position'] !== null) {
                $categoryDataRow['position'] = (int) $categoryDataRow['position'];
            }

            if (isset($categoryDataRow['is_blacklisted'])) {
                $categoryDataRow['is_blacklisted'] = (bool) $categoryDataRow['is_blacklisted'];
            }

            $indexData[$productId]['category'][] = array_filter($categoryDataRow);
        }

        return $indexData;
    }
public function addData ( $ storeId , array $ indexData ) { $ categoryData = $ this -> resourceModel -> loadCategoryData ( $ storeId , array_keys ( $ indexData ) ) ; foreach ( $ categoryData as $ categoryDataRow ) { $ productId = ( int ) $ categoryDataRow [ 'product_id' ] ; unset ( $ categoryDataRow [ 'product_id' ] ) ; $ categoryDataRow = array_merge ( $ categoryDataRow , [ 'category_id' => ( int ) $ categoryDataRow [ 'category_id' ] , 'is_parent' => ( bool ) $ categoryDataRow [ 'is_parent' ] , 'name' => ( string ) $ categoryDataRow [ 'name' ] , ] ) ; if ( isset ( $ categoryDataRow [ 'position' ] ) && $ categoryDataRow [ 'position' ] !== null ) { $ categoryDataRow [ 'position' ] = ( int ) $ categoryDataRow [ 'position' ] ; } if ( isset ( $ categoryDataRow [ 'is_blacklisted' ] ) ) { $ categoryDataRow [ 'is_blacklisted' ] = ( bool ) $ categoryDataRow [ 'is_blacklisted' ] ; } $ indexData [ $ productId ] [ 'category' ] [ ] = array_filter ( $ categoryDataRow ) ; } return $ indexData ; }
Add categories data to the index data.

{@inheritdoc}
Add categories data to the index data .