<commit_before><?php

namespace InsaLan\TournamentBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;

class TournamentAdmin extends Admin
{
    // Fields to be shown on create/edit forms
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->add('name')
            ->add('description')
            ->add('registrationOpen')
            ->add('registrationClose')
            ->add('tournamentOpen')
            ->add('tournamentClose')
            ->add('registrationLimit')
            ->add('webPrice')
            ->add('currency')
            ->add('onlineIncreaseInPrice')
            ->add('teamMaxPlayer')
            ->add('teamMinPlayer')
            ->add('participantType', 'choice', array(
                'choices' => array(
                    'team' => 'Par équipe',
                    'player' => 'Joueur seul'
                ),
                'required' => true
            ))
            ->add('type', 'choice', array(
                'choices'   => array(
                    'lol' => 'League of Legends',
                    'csgo' => 'Counter Strike Global Offensive',
                    'hs' => 'HearthStone',
                    'dota2' => 'Dota 2',
                    'sc2' => 'StarCraft 2',
                    'manual' => 'Autre/Manuel'),
                'required'  => true))
            ->add('file', 'file', array('required' => false))
        ;
    }

    // Fields to be shown on filter forms
    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('name')
            ->add('type')
        ;
    }

    // Fields to be shown on lists
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('name')
            ->add('registrationOpen')
            ->add('registrationClose')
            ->add('registrationLimit')
            ->add('participantType')
            ->add('type')
        ;
    }
    
    public function prePersist($e) {
        $e->upload();
    }
    
    public function preUpdate($e) {
        $this->prePersist($e);
    }
}
<commit_msg>[Tournament] Add locked option in menu<commit_after><?php

namespace InsaLan\TournamentBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;

class TournamentAdmin extends Admin
{
    // Fields to be shown on create/edit forms
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->add('name')
            ->add('description')
            ->add('registrationOpen')
            ->add('registrationClose')
            ->add('tournamentOpen')
            ->add('tournamentClose')
            ->add('registrationLimit')
            ->add('webPrice')
            ->add('currency')
            ->add('onlineIncreaseInPrice')
            ->add('teamMaxPlayer')
            ->add('teamMinPlayer')
            ->add('locked', null, array('required'=>false))
            ->add('participantType', 'choice', array(
                'choices' => array(
                    'team' => 'Par équipe',
                    'player' => 'Joueur seul'
                ),
                'required' => true
            ))
            ->add('type', 'choice', array(
                'choices'   => array(
                    'lol' => 'League of Legends',
                    'csgo' => 'Counter Strike Global Offensive',
                    'hs' => 'HearthStone',
                    'dota2' => 'Dota 2',
                    'sc2' => 'StarCraft 2',
                    'manual' => 'Autre/Manuel'),
                'required'  => true))
            ->add('file', 'file', array('required' => false))
        ;
    }

    // Fields to be shown on filter forms
    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('name')
            ->add('type')
        ;
    }

    // Fields to be shown on lists
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('name')
            ->add('registrationOpen')
            ->add('registrationClose')
            ->add('registrationLimit')
            ->add('participantType')
            ->add('type')
        ;
    }
    
    public function prePersist($e) {
        $e->upload();
    }
    
    public function preUpdate($e) {
        $this->prePersist($e);
    }
}

{'fraction_non_alphanumeric': 0.13664332696796097, 'fraction_numerical': 0.001697432633142372, 'mean_word_length': 1.6602708803611739, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 81, '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': '2271215', 'n_tokens_mistral': 1325, 'n_tokens_neox': 1254, 'n_words': 250}