<commit_before><?php

namespace Application\Sonata\ClientBundle\Admin;

use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Component\Form\Extension\Core\Type\CountryType;

use Knp\Menu\ItemInterface as MenuItemInterface;
use Symfony\Component\HttpFoundation\Request;

use Application\Sonata\ClientBundle\Admin\AbstractTabsAdmin as Admin;

class CommentaireAdmin extends Admin
{
    protected $_prefix_label = 'commentaire';

    //create & edit form
    /**
     * @param FormMapper $formMapper
     */
    protected function configureFormFields(FormMapper $formMapper)
    {

        $filter = $this->getRequest()->query->get('filter');

        $label = 'form.' . $this->_prefix_label . '.';
        $formMapper->with($label . 'title')
            ->add('client_id', 'hidden', array('data' => $filter['client_id']['value']))
            ->add('date', null, array('label' => $label . 'date'))
            ->add('categorie', null, array('label' => $label . 'categorie'))
            ->add('note', null, array('label' => $label . 'note'));
    }

    //list
    /**
     * @param ListMapper $listMapper
     */
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper->addIdentifier('id', null);

        $label = 'list.' . $this->_prefix_label . '.';
        $listMapper
            ->add('date', null, array('label' => $label . 'date'))
            ->add('categorie', null, array('label' => $label . 'categorie'))
            ->add('note', null, array('label' => $label . 'note'));
    }
}
<commit_msg>Review #66 :: Client Admin - Commentaire sort by Catégorie<commit_after><?php

namespace Application\Sonata\ClientBundle\Admin;

use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Component\Form\Extension\Core\Type\CountryType;

use Knp\Menu\ItemInterface as MenuItemInterface;
use Symfony\Component\HttpFoundation\Request;

use Application\Sonata\ClientBundle\Admin\AbstractTabsAdmin as Admin;

class CommentaireAdmin extends Admin
{
    protected $_prefix_label = 'commentaire';

    //create & edit form
    /**
     * @param FormMapper $formMapper
     */
    protected function configureFormFields(FormMapper $formMapper)
    {

        $filter = $this->getRequest()->query->get('filter');

        $label = 'form.' . $this->_prefix_label . '.';
        $formMapper->with($label . 'title')
            ->add('client_id', 'hidden', array('data' => $filter['client_id']['value']))
            ->add('date', null, array('label' => $label . 'date'))
            ->add('categorie', null, array('label' => $label . 'categorie'))
            ->add('note', null, array('label' => $label . 'note'));
    }

    //list
    /**
     * @param ListMapper $listMapper
     */
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper->addIdentifier('id', null);

        $label = 'list.' . $this->_prefix_label . '.';
        $listMapper
            ->add('date', null, array('label' => $label . 'date'))
            ->add('categorie.name', null, array('label' => $label . 'categorie'))
            ->add('note', null, array('label' => $label . 'note'));
    }
}

{'fraction_non_alphanumeric': 0.16647024160282853, 'fraction_numerical': 0.0005892751915144372, 'mean_word_length': 3.130170316301703, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, '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': '936366', 'n_tokens_mistral': 1016, 'n_tokens_neox': 1006, 'n_words': 197}