public function getAllCommentsSortedByParentAndIdAsc($source, $context)
    {
        /**
         * @var QueryBuilder
         */
        $queryBuilder = $this
            ->createQueryBuilder('c')
            ->where('c.source = :source')
            ->andWhere('c.context = :context')
            ->andWhere('c.enabled = :enabled')
            ->addOrderBy('c.parent', 'asc')
            ->addOrderBy('c.id', 'asc')
            ->setParameters([
                'source' => $source,
                'context' => $context,
                'enabled' => true,
            ]);

        $comments = $queryBuilder
            ->getQuery()
            ->getResult();

        return new ArrayCollection($comments);
    }
public function getAllCommentsSortedByParentAndIdAsc($source, $context)
    {
        /**
         * @var QueryBuilder
         */
        $queryBuilder = $this
            ->createQueryBuilder('c')
            ->where('c.source = :source')
            ->andWhere('c.context = :context')
            ->andWhere('c.enabled = :enabled')
            ->addOrderBy('c.parent', 'asc')
            ->addOrderBy('c.id', 'asc')
            ->setParameters([
                'source' => $source,
                'context' => $context,
                'enabled' => true,
            ]);

        $comments = $queryBuilder
            ->getQuery()
            ->getResult();

        return new ArrayCollection($comments);
    }
public function getAllCommentsSortedByParentAndIdAsc ( $ source , $ context ) { /**
         * @var QueryBuilder
         */ $ queryBuilder = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.source = :source' ) -> andWhere ( 'c.context = :context' ) -> andWhere ( 'c.enabled = :enabled' ) -> addOrderBy ( 'c.parent' , 'asc' ) -> addOrderBy ( 'c.id' , 'asc' ) -> setParameters ( [ 'source' => $ source , 'context' => $ context , 'enabled' => true , ] ) ; $ comments = $ queryBuilder -> getQuery ( ) -> getResult ( ) ; return new ArrayCollection ( $ comments ) ; }
Get all comments ordered by parent elements and position, ascendant.

@param string $source  Source
@param string $context Context of comment

@return Collection Category collection
Get all comments ordered by parent elements and position ascendant .