/**
  * Find a product by its id or return a 404 response
  *
  * @param int $id the product id
  *
  * @throws NotFoundHttpException
  *
  * @return ProductInterface
  */
 protected function findProductOr404($id)
 {
     $product = $this->productRepository->findOneById($id);
     if (!$product) {
         throw new NotFoundHttpException(sprintf('Product with id %s could not be found.', $id));
     }
     $this->productBuilder->addMissingAssociations($product);
     return $product;
 }