/** * 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' => array_values($this->productRepository->getProductsByGroup($group, self::MAX_PRODUCTS)), 'productCount' => $this->productRepository->getProductCountByGroup($group)], 'internal_api')); }