<commit_before><?php

namespace Acseo\Bundle\StartupWeekendBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Acseo\Bundle\StartupWeekendBundle\Entity\Event;

use Doctrine\Common\Collections\ArrayCollection;

/**
 * Event controller.
 *
 * @Route("/event")
 */
class EventController extends Controller
{
    /**
     * Lists all Event entities.
     *
     * @Route("/", name="event")
     * @Template()
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getEntityManager();

        $entities = $em->getRepository('AcseoStartupWeekendBundle:Event')->findAll();

        return array('entities' => $entities);
    }

    /**
     * Finds and displays a Event entity.
     *
     * @Route("/{id}/show", name="event_show")
     * @Template()
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getEntityManager();

        $entity = $em->getRepository('AcseoStartupWeekendBundle:Event')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Event entity.');
        }

        return array(
            'entity'      => $entity,
        );
    }

    /**
     * Finds and displays lastEvents
     *
     * @Route("/lastEvents/{max}", name="event_last")
     * @Template()
     */
    public function lastEventsAction($max)
    {
        $em = $this->getDoctrine()->getEntityManager();

        // $query = $em->createQuery("SELECT e FROM Acseo\Bundle\StartupWeekendBundle\Entity\Event e ORDER BY e.eventDate LIMIT 0,$max");
        // $lastEvents = $query->getResult();
        $qb = $em->createQueryBuilder();
        $qb->add('select', 'e')
           ->add('from', 'Acseo\Bundle\StartupWeekendBundle\Entity\Event e')
           //->add('where', 'u.id = ?1')
           ->add('orderBy', 'e.eventDate DESC')
           //->limit(5);
           ->setMaxResults( $max );
        
        $query = $qb->getQuery();
        $lastEvents = $query->getResult();
        return array("lastEvents" => $lastEvents);   
    }
}
<commit_msg>minor modification<commit_after><?php

namespace Acseo\Bundle\StartupWeekendBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Acseo\Bundle\StartupWeekendBundle\Entity\Event;

use Doctrine\Common\Collections\ArrayCollection;

/**
 * Event controller.
 *
 * @Route("/event")
 */
class EventController extends Controller
{
    /**
     * Lists all Event entities.
     *
     * @Route("/", name="event")
     * @Template()
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getEntityManager();

        $entities = $em->getRepository('AcseoStartupWeekendBundle:Event')->findAll();

        return array('entities' => $entities);
    }

    /**
     * Finds and displays a Event entity.
     *
     * @Route("/{id}/show", name="event_show")
     * @Template()
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getEntityManager();

        $entity = $em->getRepository('AcseoStartupWeekendBundle:Event')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Event entity.');
        }

        return array(
            'event'      => $entity,
        );
    }

    /**
     * Finds and displays lastEvents
     *
     * @Route("/lastEvents/{max}", name="event_last")
     * @Template()
     */
    public function lastEventsAction($max)
    {
        $em = $this->getDoctrine()->getEntityManager();

        // $query = $em->createQuery("SELECT e FROM Acseo\Bundle\StartupWeekendBundle\Entity\Event e ORDER BY e.eventDate LIMIT 0,$max");
        // $lastEvents = $query->getResult();
        $qb = $em->createQueryBuilder();
        $qb->add('select', 'e')
           ->add('from', 'Acseo\Bundle\StartupWeekendBundle\Entity\Event e')
           //->add('where', 'u.id = ?1')
           ->add('orderBy', 'e.eventDate DESC')
           //->limit(5);
           ->setMaxResults( $max );
        
        $query = $qb->getQuery();
        $lastEvents = $query->getResult();
        return array("lastEvents" => $lastEvents);   
    }
}

{'fraction_non_alphanumeric': 0.16061946902654867, 'fraction_numerical': 0.001327433628318584, 'mean_word_length': 2.628410914927769, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '4045269', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1341, 'n_words': 231}