setCategoryIds example

$product->setHasAvailableVariant(false);
            }

            if (isset($average[$number])) {
                $product->setVoteAverage($average[$number]);
            }

            if (isset($calculated[$number])) {
                $product->setCalculatedPrices($calculated[$number]);
            }
            if (isset($categories[$id])) {
                $product->setCategoryIds($categories[$id]);
            }
            if (isset($properties[$id])) {
                $product->setProperties($properties[$id]);
            }

            if (isset($manualPositions[$id])) {
                $product->setManualSorting($manualPositions[$id]);
            }

            $product->setFormattedCreatedAt(
                $this->formatDate($product->getCreatedAt())
            );
$emotion->setSeoDescription($data['__emotion_seo_description']);
        $emotion->setCreateDate($this->createDate($data['__emotion_create_date']));
        $emotion->setModifiedDate($this->createDate($data['__emotion_modified']));
        $emotion->setTemplateId((int) $data['__emotion_template_id']);
        $emotion->setDevices(array_map('\intval', explode(',', $data['__emotion_device'])));
        $emotion->setFullscreen((bool) $data['__emotion_fullscreen']);
        $emotion->setMode($data['__emotion_mode']);
        $emotion->setPosition((int) $data['__emotion_position']);
        $emotion->setParentId($data['__emotion_parent_id'] !== null ? (int) $data['__emotion_parent_id'] : null);
        $emotion->setIsPreview((bool) $data['__emotion_preview_id']);
        $emotion->setPreviewSecret($data['__emotion_preview_secret']);
        $emotion->setCategoryIds(array_map('\intval', explode(',', $data['__emotion_category_ids'])));
        $emotion->setShopIds(array_map('\intval', explode(',', $data['__emotion_shop_ids'])));

        // assign template         $this->assignTemplate($emotion$data);

        // assign attribute         if (!empty($data['__emotionAttribute_id'])) {
            $this->attributeHydrator->addAttribute($emotion$data, 'emotionAttribute');
        }

        return $emotion;
    }
/** * @param array<string> $streamIds * @param array<string>|null $categoryIds */
    private function getProductEntity(?array $streamIds, ?array $categoryIds): ProductEntity
    {
        $product = new ProductEntity();

        $product->setId(Uuid::randomHex());
        $product->setStreamIds($streamIds);
        $product->setCategoryIds($categoryIds);

        return $product;
    }

    private function getSalesChannelContext(): SalesChannelContext
    {
        $salesChannelEntity = new SalesChannelEntity();
        $salesChannelEntity->setId('salesChannelId');
        $salesChannelEntity->setNavigationCategoryId('navigationCategoryId');
        $salesChannelEntity->setServiceCategoryId('serviceCategoryId');
        $salesChannelEntity->setFooterCategoryId('footerCategoryId');

        
Home | Imprint | This part of the site doesn't use cookies.