<commit_before><?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
namespace Acme\BlogBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

/**
 * Blog controller
 */

class BlogController extends Controller{
    /**
     * Show a blog entry
     */
    public function showAction($id){
        $em = $this->getDoctrine()->getManager();
        
        $blog = $em->getRepository('AcmeBlogBundle:Blog')->find($id);
        
        if (!$blog){
            throw $this->createNotFoundException('Unable to find Blog post.');
        }
        
        return $this->render('AcmeBlogBundle:Blog:show.html.twig', array(
            'blog' => $blog
        ));
    }
}
<commit_msg>update blog show action in controller to retrieve comments associated to the blog by using custom repository comment method defined before<commit_after><?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
namespace Acme\BlogBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

/**
 * Blog controller
 */

class BlogController extends Controller{
    /**
     * Show a blog entry
     */
    public function showAction($id){
        $em = $this->getDoctrine()->getManager();
        
        $blog = $em->getRepository('AcmeBlogBundle:Blog')->find($id);
        
        if (!$blog){
            throw $this->createNotFoundException('Unable to find Blog post.');
        }
        
        $comments = $em->getRepository('AcmeBlogBundle:Comment')->getCommentsForBlog($blog->getId());
                
        return $this->render('AcmeBlogBundle:Blog:show.html.twig', array(
            'blog' => $blog,
            'comments' => $comments
        ));
    }
}

{'fraction_non_alphanumeric': 0.12188928390045708, 'fraction_numerical': 0.0, 'mean_word_length': 2.6685288640595903, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '6433082', 'n_tokens_mistral': 526, 'n_tokens_neox': 517, 'n_words': 146}