Ejemplo n.º 1
0
 /**
  * Finds all votes belonging to a comment.
  *
  * @param VotableCommentInterface $comment
  * @return array of VoteInterface
  */
 public function findVotesByComment(VotableCommentInterface $comment)
 {
     $qb = $this->repository->createQueryBuilder();
     $qb->field('comment.$id')->equals($comment->getId());
     $qb->sort('createdAt', 'ASC');
     $votes = $qb->getQuery()->execute();
     return $votes;
 }
Ejemplo n.º 2
0
 /**
  * Finds all votes belonging to a comment.
  *
  * @param  \FOS\CommentBundle\Model\VotableCommentInterface $comment
  * @return array|null
  */
 public function findVotesByComment(VotableCommentInterface $comment)
 {
     $qb = $this->repository->createQueryBuilder('v');
     $qb->join('v.comment', 'c');
     $qb->andWhere('c.id = :commentId');
     $qb->setParameter('commentId', $comment->getId());
     $votes = $qb->getQuery()->execute();
     return $votes;
 }