Components/Bundle/ShopwareAdapter/CommandHandler/HandleBundleCommandHandler.php
private function getArticles(Bundle $bundle, BundleModel $bundleModel, DetailModel $mainVariant)
    {
        $repository = $this->entityManager->getRepository(DetailModel::class);

        $result = [];
        foreach ($bundle->getBundleProducts() as $bundleProduct) {
            if ($mainVariant->getNumber() === $bundleProduct->getNumber()) {
                continue;
            }

            $detail = $repository->findOneBy(['number' => $bundleProduct->getNumber()]);

            if (null === $detail) {
                $this->logger->error('bundle product not found => number: ' . $bundleProduct->getNumber());
                $this->active = false;

                continue;
            }

            $product = new Article();
            $product->setQuantity($bundleProduct->getAmount());
            $product->setArticleDetail($detail);
            $product->setPosition($bundleProduct->getPosition());
            $product->setBundle($bundleModel);

            $this->entityManager->persist($product);
            $result[] = $product;
        }

        return new ArrayCollection($result);
    }
private function getArticles(Bundle $bundle, BundleModel $bundleModel, DetailModel $mainVariant)
    {
        $repository = $this->entityManager->getRepository(DetailModel::class);

        $result = [];
        foreach ($bundle->getBundleProducts() as $bundleProduct) {
            if ($mainVariant->getNumber() === $bundleProduct->getNumber()) {
                continue;
            }

            $detail = $repository->findOneBy(['number' => $bundleProduct->getNumber()]);

            if (null === $detail) {
                $this->logger->error('bundle product not found => number: ' . $bundleProduct->getNumber());
                $this->active = false;

                continue;
            }

            $product = new Article();
            $product->setQuantity($bundleProduct->getAmount());
            $product->setArticleDetail($detail);
            $product->setPosition($bundleProduct->getPosition());
            $product->setBundle($bundleModel);

            $this->entityManager->persist($product);
            $result[] = $product;
        }

        return new ArrayCollection($result);
    }
@param Bundle      $bundle
@param BundleModel $bundleModel
@param DetailModel $mainVariant

@return ArrayCollection