<commit_before><?php

namespace Games\KillerBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Symfony\Component\HttpFoundation\Request;

use Games\UserBundle\Form\User;
use Games\KillerBundle\Entity\Killer;
use Games\KillerBundle\Form\KillerType;

class DefaultController extends Controller
{
    public function indexAction($name)
    {
        return $this->render('GamesKillerBundle:Default:index.html.twig', array('name' => $name));
    }
    
    //cette méthode crée une partie de Killer
    public function createKillerAction(Request $request)
    {
        // On récupere l'utilisateur actuel
        $user = $this->get('security.context')->getToken()->getUser();
        
        
        // On crée un objet Killer
        $killer = new Killer();
        
        $form = $this->get('form.factory')->create(new KillerType, $killer);
    
    
        if ($form->handleRequest($request)->isValid()) {
            
            
            $em = $this->getDoctrine()->getManager();
            
            $user->addMyKiller($killer);<commit_msg>Adding a redirection for newKiller route if not authenticated Visitors<commit_after><?php

namespace Games\KillerBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;


use Games\UserBundle\Form\User;
use Games\KillerBundle\Entity\Killer;
use Games\KillerBundle\Form\KillerType;

class DefaultController extends Controller
{
    public function indexAction($name)
    {
        return $this->render('GamesKillerBundle:Default:index.html.twig', array('name' => $name));
    }
    
    
    //cette méthode crée une partie de Killer
    public function createKillerAction(Request $request)
    {
        // On vérifie que l'utilisateur dispose bien du rôle ROLE_AUTEUR
        if (!$this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
            // Sinon on déclenche une exception « Accès interdit »
            throw new AccessDeniedException('Accès limité aux personnes authentifiées.');
        }
        
        
        // On récupere l'utilisateur actuel
        $user = $this->get('security.context')->getToken()->getUser();
        
        
        // On crée un objet Killer
        $killer = new Killer();
        
        $form = $this->get('form.factory')->create(new KillerType, $killer);
    
    
        if ($form->handleRequest($request)->isValid()) {
            
            
            $em = $this->getDoctrine()->getManager();
            
            $user->addMyKiller($killer);
{'fraction_non_alphanumeric': 0.11924528301886793, 'fraction_numerical': 0.0, 'mean_word_length': 2.661602209944751, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '6268248', 'n_tokens_mistral': 760, 'n_tokens_neox': 764, 'n_words': 153}