<commit_before><?php

namespace CftfBundle\Form\Type;

use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class LsDocListType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('lsDoc', EntityType::class, [
                'label' => 'Document:',
                'choice_label' => 'title',
                'group_by' => 'creator',
                'required' => false,
                'multiple' => false,
                'class' => 'CftfBundle\Entity\LsDoc',
                'query_builder' => function (EntityRepository $er) {
                    return $er->createQueryBuilder('d')
                        ->addOrderBy('d.creator', 'ASC')
                        ->addOrderBy('d.title', 'ASC')
                        ;
                },
            ])<commit_msg>fix: add max length to framework titles and creators<commit_after><?php

namespace CftfBundle\Form\Type;

use CftfBundle\Entity\LsDoc;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class LsDocListType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('lsDoc', EntityType::class, [
                'label' => 'Document:',
                'choice_label' => function(LsDoc $val) {
                    $title = $val->getTitle();
                    if (strlen($title) > 60) {
                        return substr($val->getTitle(), 0, 59)."\u{2026}";
                    }

                    return $title;
                },
                'group_by' => function(LsDoc $val) {
                    $creator = $val->getCreator();
                    if (strlen($creator) > 60) {
                        return substr($val->getCreator(), 0, 59)."\u{2026}";
                    }

                    return $creator;
                },
                'required' => false,
                'multiple' => false,
                'class' => 'CftfBundle\Entity\LsDoc',
                'query_builder' => function (EntityRepository $er) {
                    return $er->createQueryBuilder('d')
                        ->addOrderBy('d.creator', 'ASC')
                        ->addOrderBy('d.title', 'ASC')
                        ;
                },
            ])
{'fraction_non_alphanumeric': 0.125, 'fraction_numerical': 0.006320224719101123, 'mean_word_length': 1.6852026390197927, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '662722', 'n_tokens_mistral': 796, 'n_tokens_neox': 746, 'n_words': 142}