<commit_before><?php

namespace AppBundle\Admin;

use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Form\Type\ModelType;
use Sonata\AdminBundle\Route\RouteCollection;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;

/**
 * Class PersonAdmin.
 *
 * @category Admin
 *
 * @author   <NAME> <<EMAIL>>
 */
class PersonAdmin extends AbstractBaseAdmin
{
    protected $classnameLabel = 'Person';
    protected $baseRoutePattern = 'administration/person';
    protected $datagridValues = array(
        '_sort_by' => 'name',
        '_sort_order' => 'asc',
    );

    /**
     * Configure route collection.
     *
     * @param RouteCollection $collection
     */
    protected function configureRoutes(RouteCollection $collection)
    {
        parent::configureRoutes($collection);
    }

    /**
     * @param FormMapper $formMapper
     */
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->with('backend.admin.general', $this->getFormMdSuccessBoxArray(4))
            ->add(
                'dni',
                null,
                array(
                    'label' => 'backend.admin.parent.dni',
                )
            )
            ->add(
                'name',
                null,
                array(
                    'label' => 'backend.admin.parent.name',
                )
            )
            ->add(
                'surname',
                null,
                array(
                    'label' => 'backend.admin.parent.surname',
                )
            )
            ->end()
            ->with('backend.admin.contact.contact', $this->getFormMdSuccessBoxArray(4))
            ->add(
                'phone',
                null,
                array(
                    'label' => 'backend.admin.parent.phone',
                )
            )
            ->add(
                'email',
                null,
                array(
                    'label' => 'backend.admin.parent.email',
                    'required' => false,
                )
            )
            ->add(
                'address',
                null,
                array(
                    'label' => 'backend.admin.parent.address',
                    'required' => false,
                )
            )
            ->add(
                'city',
                null,
                array(
                    'label' => 'backend.admin.parent.city',
                    'required' => true,
                )
            )
            ->end()
            ->with('backend.admin.controls', $this->getFormMdSuccessBoxArray(3))
            ->add(
                'bank',
                ModelType::class,
                array(
                    'label' => 'backend.admin.parent.bank',
                    'class' => 'AppBundle:Bank',
                    'required' => false,
                    'multiple' => false,
//                    'query_builder' => $this->rm->getUserRepository()->getEnabledSortedByNameQB(),
//                    'by_reference' => false,
                    'btn_add' => true,
                )
            )
            ->add(
                'students',
                null,
                array(
                    'label' => 'backend.admin.parent.students',
                    'required' => false,
                    'disabled' => true,
                )
            )
            ->add(
                'enabled',
                CheckboxType::class,
                array(
                    'label' => 'backend.admin.enabled',
                    'required' => false,
                )
            )
            ->end()
        ;
    }
<commit_msg>improve Person edit form admin<commit_after><?php

namespace AppBundle\Admin;

use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Form\Type\AdminType;
use Sonata\AdminBundle\Route\RouteCollection;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;

/**
 * Class PersonAdmin.
 *
 * @category Admin
 *
 * @author   <NAME> <<EMAIL>>
 */
class PersonAdmin extends AbstractBaseAdmin
{
    protected $classnameLabel = 'Person';
    protected $baseRoutePattern = 'administration/person';
    protected $datagridValues = array(
        '_sort_by' => 'name',
        '_sort_order' => 'asc',
    );

    /**
     * Configure route collection.
     *
     * @param RouteCollection $collection
     */
    protected function configureRoutes(RouteCollection $collection)
    {
        parent::configureRoutes($collection);
    }

    /**
     * @param FormMapper $formMapper
     */
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->with('backend.admin.general', $this->getFormMdSuccessBoxArray(4))
            ->add(
                'dni',
                null,
                array(
                    'label' => 'backend.admin.parent.dni',
                )
            )
            ->add(
                'name',
                null,
                array(
                    'label' => 'backend.admin.parent.name',
                )
            )
            ->add(
                'surname',
                null,
                array(
                    'label' => 'backend.admin.parent.surname',
                )
            )
            ->end()
            ->with('backend.admin.contact.contact', $this->getFormMdSuccessBoxArray(4))
            ->add(
                'phone',
                null,
                array(
                    'label' => 'backend.admin.parent.phone',
                )
            )
            ->add(
                'email',
                null,
                array(
                    'label' => 'backend.admin.parent.email',
                    'required' => false,
                )
            )
            ->add(
                'address',
                null,
                array(
                    'label' => 'backend.admin.parent.address',
                    'required' => false,
                )
            )
            ->add(
                'city',
                null,
                array(
                    'label' => 'backend.admin.parent.city',
                    'required' => true,
                )
            )
            ->end()
            ->with('backend.admin.controls', $this->getFormMdSuccessBoxArray(3))
            ->add(
                'bank',
                AdminType::class,
                array(
                    'label' => ' ',
                    'required' => false,
                    'btn_add' => false,
                )
            )
            ->add(
                'students',
                null,
                array(
                    'label' => 'backend.admin.parent.students',
                    'required' => false,
                    'disabled' => true,
                )
            )
            ->add(
                'enabled',
                CheckboxType::class,
                array(
                    'label' => 'backend.admin.enabled',
                    'required' => false,
                )
            )
            ->end()
        ;
    }

{'fraction_non_alphanumeric': 0.11911244214538524, 'fraction_numerical': 0.0008167710318540703, 'mean_word_length': 1.053381777529346, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 94, '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': '7230956', 'n_tokens_mistral': 1923, 'n_tokens_neox': 1794, 'n_words': 297}