<commit_before><?php

namespace Acme\BlogBundle\Entity\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * CommentRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class CommentRepository extends EntityRepository
{
}<commit_msg>get the comments for one blog<commit_after><?php

namespace Acme\BlogBundle\Entity\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * CommentRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class CommentRepository extends EntityRepository
{
    public function getCommentsForBlog($blogId, $approved = true) {
        $qb = $this->createQueryBuilder('c')
                ->where('c.blog = :blog_id')
                ->addOrderBy('c.created')
                ->setParameter('blog_id', $blogId);
        if (false === is_null($approved)){
            $qb->andWhere('c.approved = :approved')
                ->setParameter('approved', $approved);
        }
        
        return $qb->getQuery()->getResult();
    }
}
{'fraction_non_alphanumeric': 0.12084870848708487, 'fraction_numerical': 0.0, 'mean_word_length': 3.033457249070632, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3748168', 'n_tokens_mistral': 308, 'n_tokens_neox': 294, 'n_words': 76}