getVariants() public méthode

public getVariants ( ) : Doctrine\Common\Collections\Collection
Résultat Doctrine\Common\Collections\Collection
 /**
  * {@inheritdoc}
  */
 public function getAttributes(ProductInterface $product) : array
 {
     $attributes = [];
     $product->getVariants()->map(function (VariantInterface $variant) use(&$attributes) {
         $this->extractAttributesData($variant, $attributes);
     });
     return $attributes;
 }
 public function addAction(ProductInterface $product, VariantInterface $variant = null, int $quantity = 1) : Response
 {
     $variants = $product->getVariants();
     if ($variants->count() && false === $variants->contains($variant)) {
         return $this->redirectToRoute('front.product.view', ['id' => $product->getId()]);
     }
     try {
         $this->manager->addProductToCart($product, $variant, $quantity);
     } catch (AddCartItemException $exception) {
         return $this->jsonResponse(['error' => $exception->getMessage(), 'previousError' => $exception->getPrevious()->getMessage()]);
     }
     $category = $product->getCategories()->first();
     $recommendations = $this->get('product.helper')->getProductRecommendationsForCategory($category);
     $basketModalContent = $this->renderView('WellCommerceCartBundle:Front/Cart:add.html.twig', ['product' => $product, 'recommendations' => $recommendations]);
     $cartPreviewContent = $this->renderView('WellCommerceCartBundle:Front/Common:preview.html.twig');
     return $this->jsonResponse(['basketModalContent' => $basketModalContent, 'cartPreviewContent' => $cartPreviewContent, 'templateData' => []]);
 }