コード例 #1
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;
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 public function findInvoiceItemsByInvoiceId($invoiceId)
 {
     $qb = $this->repository->createQueryBuilder('a');
     $qb->join('a.invoice', 't')->where('t.id = :invoiceId')->setParameter('invoiceId', $invoiceId);
     $invoiceiItems = $qb->getQuery()->execute();
     if (!$invoiceiItems) {
         return array();
     }
     return $invoiceiItems;
 }
コード例 #3
0
 /**
  * Returns the requested comment tree branch
  *
  * @param integer $commentId
  * @param string $sorter
  * @return array See findCommentTreeByThread
  */
 public function findCommentTreeByCommentId($commentId, $sorter = null)
 {
     $qb = $this->repository->createQueryBuilder('c');
     $qb->join('c.thread', 't')->where('LOCATE(:path, CONCAT(\'/\', CONCAT(c.ancestors, \'/\'))) > 0')->orderBy('c.ancestors', 'ASC')->setParameter('path', "/{$commentId}/");
     $comments = $qb->getQuery()->execute();
     if (!$comments) {
         return array();
     }
     $sorter = $this->getSortingFactory()->getSorter($sorter);
     $trimParents = current($comments)->getAncestors();
     return $this->organiseComments($comments, $sorter, $trimParents);
 }