<commit_before><?php

namespace Cac\BarBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
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 Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Cac\BarBundle\Entity\Bar;
use Cac\BarBundle\Entity\Comment;
use Cac\BarBundle\Entity\Promotion;
use Cac\BarBundle\Entity\Image;
use Cac\BarBundle\Entity\Highlight;
use Cac\BarBundle\Entity\DaySchedule;
use Cac\BarBundle\Form\Type\BarType;
use Cac\BarBundle\Form\Type\PromotionType;
use Cac\BarBundle\Form\Type\BarEditType;
/**
 * Bar controller.
 *
 * @Route("/pro")
 */
class ProController extends Controller
{
    /**
     * @Route("/abonnement/{id}", name="bars_abonnement")
     * @Template()
     */
    public function abonnementAction($id)
    {
        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('CacBarBundle:Bar')->find($id);

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

    /**
     * @Route("/offer/{id}", name="bars_offer")
     * @Template()
     */
    public function offerAction($id)
    {
        setlocale(LC_TIME, "fr_FR");
        $today = strftime("%A");

        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('CacBarBundle:Bar')->find($id);
        $restriction = $em->getRepository('CacBarBundle:PromotionOptionCategory')->findOneBy(array('shortcode' => 'restriction'));
        $restrictions = $em->getRepository('CacBarBundle:PromotionOption')->findBy(array('category' => $restriction->getId()));

        $lists = array(
            'drinkNumber' => array('Illimité','5','10','20','30','40','50','100'),
            'drinkDuration' => array('Illimité','1 semaine', '2 semaines', '3 semaines', '1 mois', '2 mois'),
            'printNumber' => array('X5','X10', 'X20', 'X30'),
            'days' => array('Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche')
        );

        return array(
            'bar'      => $entity,
            'today' => $today,
            'restrictions' => $restrictions,
            'promotions' => $entity->getPromotions(),
            'lists' => $lists,
        );  
    }

    /**
     * @Route("/retourOffre/{id}", name="bars_offerFeedback")
     * @Template()
     */
    public function offerFeedbackAction($id)
    {
        $em = $this->getDoctrine()->getManager();
        $bar = $em->getRepository('CacBarBundle:Bar')->find($id);
        $promoOffertes = $em->getRepository('CacBarBundle:PromoOffertes')->findBy(array('bar'=> $bar), array('id' => 'DESC'));

        return array(
            'bar'      => $bar,
            'promos' => $promoOffertes,
        );  
    }

    /**
     * @Route("/retourMail", name="bars_mailFeedback")
     * @Template()
     */
    public function offerFeedbackAction()
    {
        $user = $this->get('security.context')->getToken()->getUser();
        if ($user !== "anon." && $user->getRoles()[0] === "ROLE_BIGBOSS") {
            $em = $this->getDoctrine()->getManager();
            $barId = $em->getRepository('CacBarBundle:Bar')->findBy(array('author'=> $user->getId()));
            return $this->redirect($this->generateUrl('bars_offerFeedback', array('id' => $barId[0]->getId())));
        }

        return return $this->redirect($this->generateUrl('home'));
    }

    /**
     * @Route("/optionOffre/{id}", name="bars_option")
     * @Template()
     */
    public function optionAction($id)
    {
        setlocale(LC_TIME, "fr_FR");
        $today = strftime("%A");

        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('CacBarBundle:Bar')->find($id);
        $entities = $em->getRepository('CacBarBundle:Bar')->findAll();

        $paginator  = $this->get('knp_paginator');
        $pagination = $paginator->paginate(
            $entities,
            $this->get('request')->query->get('page', 1)/*page number*/,
            16/*limit per page*/<commit_msg>Guillaume petit pédé<commit_after><?php

namespace Cac\BarBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
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 Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Cac\BarBundle\Entity\Bar;
use Cac\BarBundle\Entity\Comment;
use Cac\BarBundle\Entity\Promotion;
use Cac\BarBundle\Entity\Image;
use Cac\BarBundle\Entity\Highlight;
use Cac\BarBundle\Entity\DaySchedule;
use Cac\BarBundle\Form\Type\BarType;
use Cac\BarBundle\Form\Type\PromotionType;
use Cac\BarBundle\Form\Type\BarEditType;
/**
 * Bar controller.
 *
 * @Route("/pro")
 */
class ProController extends Controller
{
    /**
     * @Route("/abonnement/{id}", name="bars_abonnement")
     * @Template()
     */
    public function abonnementAction($id)
    {
        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('CacBarBundle:Bar')->find($id);

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

    /**
     * @Route("/offer/{id}", name="bars_offer")
     * @Template()
     */
    public function offerAction($id)
    {
        setlocale(LC_TIME, "fr_FR");
        $today = strftime("%A");

        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('CacBarBundle:Bar')->find($id);
        $restriction = $em->getRepository('CacBarBundle:PromotionOptionCategory')->findOneBy(array('shortcode' => 'restriction'));
        $restrictions = $em->getRepository('CacBarBundle:PromotionOption')->findBy(array('category' => $restriction->getId()));

        $lists = array(
            'drinkNumber' => array('Illimité','5','10','20','30','40','50','100'),
            'drinkDuration' => array('Illimité','1 semaine', '2 semaines', '3 semaines', '1 mois', '2 mois'),
            'printNumber' => array('X5','X10', 'X20', 'X30'),
            'days' => array('Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche')
        );

        return array(
            'bar'      => $entity,
            'today' => $today,
            'restrictions' => $restrictions,
            'promotions' => $entity->getPromotions(),
            'lists' => $lists,
        );  
    }

    /**
     * @Route("/retourOffre/{id}", name="bars_offerFeedback")
     * @Template()
     */
    public function offerFeedbackAction($id)
    {
        $em = $this->getDoctrine()->getManager();
        $bar = $em->getRepository('CacBarBundle:Bar')->find($id);
        $promoOffertes = $em->getRepository('CacBarBundle:PromoOffertes')->findBy(array('bar'=> $bar), array('id' => 'DESC'));

        return array(
            'bar'      => $bar,
            'promos' => $promoOffertes,
        );  
    }

    /**
     * @Route("/retourMail", name="bars_mailFeedback")
     * @Template()
     */
    public function offerMailAction()
    {
        $user = $this->get('security.context')->getToken()->getUser();
        if ($user !== "anon." && $user->getRoles()[0] === "ROLE_BIGBOSS") {
            $em = $this->getDoctrine()->getManager();
            $barId = $em->getRepository('CacBarBundle:Bar')->findBy(array('author'=> $user->getId()));
            return $this->redirect($this->generateUrl('bars_offerFeedback', array('id' => $barId[0]->getId())));
        }

        return $this->redirect($this->generateUrl('home'));
    }

    /**
     * @Route("/optionOffre/{id}", name="bars_option")
     * @Template()
     */
    public function optionAction($id)
    {
        setlocale(LC_TIME, "fr_FR");
        $today = strftime("%A");

        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('CacBarBundle:Bar')->find($id);
        $entities = $em->getRepository('CacBarBundle:Bar')->findAll();

        $paginator  = $this->get('knp_paginator');
        $pagination = $paginator->paginate(
            $entities,
            $this->get('request')->query->get('page', 1)/*page number*/,
            16/*limit per page*/
{'fraction_non_alphanumeric': 0.1893180734382451, 'fraction_numerical': 0.007391511683357177, 'mean_word_length': 2.968306527909177, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 129, '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': '3824967', 'n_tokens_mistral': 2685, 'n_tokens_neox': 2617, 'n_words': 376}