<commit_before><?php

namespace FM\CalendarBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
    public function indexAction()
    {
        $query = $this->getDoctrine()->getRepository('FMCalendarBundle:Calendar')->createQueryBuilder('c')
            ->where('c.name = :name')
            ->setParameter('name','Publique')
            ->getQuery();
        $events = $query->getSingleResult()->getEvents();
        return $this->render('FMCalendarBundle:Default:index.html.twig', array('events'=>$events));
    }
}<commit_msg>Display all events when connected<commit_after><?php

namespace FM\CalendarBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
    public function indexAction()
    {
        if( $this->get('security.context')->isGranted('ROLE_USER') )
        {
            $events = $this->getDoctrine()->getRepository('FMCalendarBundle:Event')->findAll();
        }
        else 
        {
            $query = $this->getDoctrine()->getRepository('FMCalendarBundle:Calendar')->createQueryBuilder('c')
                ->where('c.name = :name')
                ->setParameter('name','Publique')
                ->getQuery();
            $events = $query->getSingleResult()->getEvents();
        }
        return $this->render('FMCalendarBundle:Default:index.html.twig', array('events'=>$events));
    }
}
{'fraction_non_alphanumeric': 0.15537303216974674, 'fraction_numerical': 0.0, 'mean_word_length': 3.213256484149856, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '1367309', 'n_tokens_mistral': 386, 'n_tokens_neox': 381, 'n_words': 55}