コード例 #1
0
 /**
  * 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());
 }
コード例 #2
0
 /**
  * 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'));
 }