/** * Get the comments related to a subject * * @param CommentSubjectInterface $subject * * @return \Doctrine\Common\Collections\ArrayCollection|\Pim\Bundle\CommentBundle\Model\CommentInterface[] */ public function getComments(CommentSubjectInterface $subject) { return $this->repository->getComments(ClassUtils::getClass($subject), $subject->getId()); }
/** * List comments made on a product * * @param int|string $id * * @AclAncestor("pim_enrich_product_comment") * * @return JsonResponse */ public function getAction($id) { $product = $this->findProductOr404($id); $comments = $this->commentRepository->getComments(ClassUtils::getClass($product), $product->getId()); return new JsonResponse($this->normalizer->normalize($comments, 'json')); }