Sonata\BasketBundle\Controller\Api\BasketController::getProduct PHP Method

getProduct() protected method

Retrieves product with id $id or throws an exception if it doesn't exist.
protected getProduct ( $id ) : Sonata\Component\Product\ProductInterface
$id
return Sonata\Component\Product\ProductInterface
    protected function getProduct($id)
    {
        $product = $this->productManager->findOneBy(array('id' => $id));
        if (null === $product) {
            throw new NotFoundHttpException(sprintf('Product (%d) not found', $id));
        }
        return $product;
    }