private function getMainVariant(Bundle $bundle)
    {
        $repository = $this->entityManager->getRepository(DetailModel::class);

        foreach ($bundle->getBundleProducts() as $bundleProduct) {
            $detail = $repository->findOneBy(['number' => $bundleProduct->getNumber()]);

            if (null === $detail) {
                throw new NotFoundException('bundle main product not found');
                continue;
            }

            return $detail;
        }

        return null;
    }
private function getMainVariant(Bundle $bundle)
    {
        $repository = $this->entityManager->getRepository(DetailModel::class);

        foreach ($bundle->getBundleProducts() as $bundleProduct) {
            $detail = $repository->findOneBy(['number' => $bundleProduct->getNumber()]);

            if (null === $detail) {
                throw new NotFoundException('bundle main product not found');
                continue;
            }

            return $detail;
        }

        return null;
    }
@param Bundle $bundle

@throws NotFoundException

@return null|object