Sonata\ProductBundle\Controller\ProductController::viewVariationsAction PHP Method

viewVariationsAction() public method

public viewVariationsAction ( $productId, $slug ) : Response
$productId
$slug
return Symfony\Component\HttpFoundation\Response
    public function viewVariationsAction($productId, $slug)
    {
        $product = is_object($productId) ? $productId : $this->get('sonata.product.set.manager')->findEnabledFromIdAndSlug($productId, $slug);
        if (!$product) {
            throw new NotFoundHttpException(sprintf('Unable to find the product with id=%d', $productId));
        }
        $provider = $this->get('sonata.product.pool')->getProvider($product);
        $action = sprintf('%s:viewVariations', $provider->getBaseControllerName());
        $response = $this->forward($action, array('product' => $product));
        if ($this->get('kernel')->isDebug()) {
            $response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s  -->\n%s\n<!-- [Sonata] end product -->\n", $this->get('sonata.product.pool')->getProductCode($product), $product->getId(), $action, $response->getContent()));
        }
        return $response;
    }