本文整理汇总了PHP中Pim\Bundle\CatalogBundle\Repository\ProductRepositoryInterface::getProductCountByGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductRepositoryInterface::getProductCountByGroup方法的具体用法?PHP ProductRepositoryInterface::getProductCountByGroup怎么用?PHP ProductRepositoryInterface::getProductCountByGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pim\Bundle\CatalogBundle\Repository\ProductRepositoryInterface
的用法示例。
在下文中一共展示了ProductRepositoryInterface::getProductCountByGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listProductsAction
/**
* Display the products of a group
*
* @param string $identifier
*
* @return JsonResponse
*
* @AclAncestor("pim_enrich_product_index")
*/
public function listProductsAction($identifier)
{
$group = $this->groupRepository->findOneBy(['code' => $identifier]);
if (!$group) {
throw new NotFoundHttpException(sprintf('Group with code "%s" not found', $identifier));
}
return new JsonResponse($this->normalizer->normalize(['products' => $this->productRepository->getProductsByGroup($group, self::MAX_PRODUCTS), 'productCount' => $this->productRepository->getProductCountByGroup($group)], 'internal_api'));
}
示例2: getProductList
/**
* Returns an array containing a limited number of product groups, and the total number of products
*
* @param GroupInterface $group
* @param int $maxResults
*
* @deprecated will be removed in 1.5
*
* @return array
*/
public function getProductList(GroupInterface $group, $maxResults)
{
$products = $this->productRepository->getProductsByGroup($group, $maxResults);
$count = $this->productRepository->getProductCountByGroup($group);
return ['products' => $products, 'productCount' => $count];
}