<commit_before><?php

namespace BlogBundle\Controller;

use BlogBundle\Entity\Article;
use BlogBundle\Entity\SignalementCom;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Form\Extension\Core\Type\TextType;

/**
 * Article controller.
 *
 */
class ArticleController extends Controller
{
    /**
     * Lists all article entities.
     *
     */
    public function indexAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();
        if($this->isGranted('ROLE_CRITIQUE')){
            $articles = $em->getRepository('BlogBundle:Article')->findArticlesCritique($this->getUser());
        }
        else if(false == $this->get('security.authorization_checker')->isGranted('ROLE_USER')) {
            $articles = $em->getRepository('BlogBundle:Article')->findArticlesNonLus($this->getUser());
        }
        else
            $articles = $em->getRepository('BlogBundle:Article')->findAll();
		
        $form = $this->createFormBuilder()
            ->add('Recherche', TextType::class)
            ->add('Valider', SubmitType::class, array('label' => 'Rechercher'))
            ->getForm();

        $form->handleRequest($request);

        $user = $this->getUser();
            // possible bug
        $articlesAffiches = array();
        foreach($articles as $article){
            $cont = 0;
            foreach($article->getThemes() as $theme){
                foreach($user->getTheme() as $userTheme){
                    if($userTheme->getAime() == $theme) {
                        $cont = 1;
                    }
                }
            }
            if($cont == 1)<commit_msg>correction role dans articlecontroller<commit_after><?php

namespace BlogBundle\Controller;

use BlogBundle\Entity\Article;
use BlogBundle\Entity\SignalementCom;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Form\Extension\Core\Type\TextType;

/**
 * Article controller.
 *
 */
class ArticleController extends Controller
{
    /**
     * Lists all article entities.
     *
     */
    public function indexAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();
        if($this->isGranted('ROLE_CRITIQUE')){
            $articles = $em->getRepository('BlogBundle:Article')->findArticlesCritique($this->getUser());
        }
        else if(false == $this->get('security.authorization_checker')->isGranted('ROLE_LECTEUR')) {
            $articles = $em->getRepository('BlogBundle:Article')->findArticlesNonLus($this->getUser());
        }
        else
            $articles = $em->getRepository('BlogBundle:Article')->findAll();
		
        $form = $this->createFormBuilder()
            ->add('Recherche', TextType::class)
            ->add('Valider', SubmitType::class, array('label' => 'Rechercher'))
            ->getForm();

        $form->handleRequest($request);

        $user = $this->getUser();
            // possible bug
        $articlesAffiches = array();
        foreach($articles as $article){
            $cont = 0;
            foreach($article->getThemes() as $theme){
                foreach($user->getTheme() as $userTheme){
                    if($userTheme->getAime() == $theme) {
                        $cont = 1;
                    }
                }
            }
            if($cont == 1)
{'fraction_non_alphanumeric': 0.1494057724957555, 'fraction_numerical': 0.001697792869269949, 'mean_word_length': 2.425387596899225, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 49, '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': '3426605', 'n_tokens_mistral': 1014, 'n_tokens_neox': 958, 'n_words': 152}