<commit_before><?php

namespace MwBundle\Form;

use AppBundle\Entity\Medewerker;
use AppBundle\Form\AppDateRangeType;
use AppBundle\Form\FilterType;
use AppBundle\Form\MedewerkerFilterType as AppMedewerkerFilterType;
use AppBundle\Form\KlantFilterType as AppKlantFilterType;
use GaBundle\Form\SelectieType;
use InloopBundle\Entity\Locatie;
use InloopBundle\Form\LocatieSelectType;
use MwBundle\Entity\Aanmelding;
use MwBundle\Entity\MwDossierStatus;
use MwBundle\Entity\Verslag;
use MwBundle\Filter\KlantFilter;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Choice;

class KlantFilterType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (array_key_exists('klant', $options['enabled_filters'])) {
            $builder->add('klant', AppKlantFilterType::class, [
                'enabled_filters' => $options['enabled_filters']['klant'],
            ]);
        }
//        if (array_key_exists('verslag', $options['enabled_filters'])) {
//            $builder->add('verslag', EntityType::class, [
//                'required' => false,
//                'class'=>Medewerker::class,
//
//            ]);
//        }
        if (in_array('medewerker', $options['enabled_filters'])) {
            $builder->add('medewerker', EntityType::class, [
                'required' => false,
                'class'=>Medewerker::class,


            ]);
        }
        if (in_array('gebruikersruimte', $options['enabled_filters'])) {
            $builder->add('gebruikersruimte', LocatieSelectType::class, [
                'required' => false,
                'gebruikersruimte' => true,
            ]);
        }

        if (in_array('laatsteIntakeLocatie', $options['enabled_filters'])) {
            $builder->add('laatsteIntakeLocatie', EntityType::class, [
                'class' => Locatie::class,
                'required' => false,
            ]);
        }

        if (in_array('laatsteIntakeDatum', $options['enabled_filters'])) {
            $builder->add('laatsteIntakeDatum', AppDateRangeType::class, [
                'required' => false,
            ]);
        }

        if (in_array('laatsteVerslagDatum', $options['enabled_filters'])) {
            $builder->add('laatsteVerslagDatum', AppDateRangeType::class, [
                'required' => false,
            ]);<commit_msg>#1065<commit_after><?php

namespace MwBundle\Form;

use AppBundle\Entity\Medewerker;
use AppBundle\Form\AppDateRangeType;
use AppBundle\Form\FilterType;
use AppBundle\Form\MedewerkerFilterType as AppMedewerkerFilterType;
use AppBundle\Form\KlantFilterType as AppKlantFilterType;
use Doctrine\ORM\EntityRepository;
use GaBundle\Form\SelectieType;
use InloopBundle\Entity\Locatie;
use InloopBundle\Form\LocatieSelectType;
use MwBundle\Entity\Aanmelding;
use MwBundle\Entity\MwDossierStatus;
use MwBundle\Entity\Verslag;
use MwBundle\Filter\KlantFilter;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Choice;

class KlantFilterType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (array_key_exists('klant', $options['enabled_filters'])) {
            $builder->add('klant', AppKlantFilterType::class, [
                'enabled_filters' => $options['enabled_filters']['klant'],
            ]);
        }
//        if (array_key_exists('verslag', $options['enabled_filters'])) {
//            $builder->add('verslag', EntityType::class, [
//                'required' => false,
//                'class'=>Medewerker::class,
//
//            ]);
//        }
        if (in_array('medewerker', $options['enabled_filters'])) {
            $builder->add('medewerker', EntityType::class, [
                'required' => false,
                'class'=>Medewerker::class,
                'query_builder' => function (EntityRepository $repository) {
                    $builder = $repository->createQueryBuilder('medewerker')
                        ->select("medewerker")
                        ->innerJoin(Verslag::class, 'verslag', 'WITH', 'verslag.medewerker = medewerker')
                        ->orderBy('medewerker.voornaam')
                        ->groupBy('verslag.medewerker')
                        ;
                    $sql = $builder->getQuery()->getSQL();
                    return $builder;
                    ;
                },


            ]);

        }
        if (in_array('gebruikersruimte', $options['enabled_filters'])) {
            $builder->add('gebruikersruimte', LocatieSelectType::class, [
                'required' => false,
                'gebruikersruimte' => true,
            ]);
        }

        if (in_array('laatsteIntakeLocatie', $options['enabled_filters'])) {
            $builder->add('laatsteIntakeLocatie', EntityType::class, [
                'class' => Locatie::class,
                'required' => false,
            ]);
        }

        if (in_array('laatsteIntakeDatum', $options['enabled_filters'])) {
            $builder->add('laatsteIntakeDatum', AppDateRangeType::class, [
                'required' => false,
            ]);
        }

        if (in_array('laatsteVerslagDatum', $options['enabled_filters'])) {
            $builder->add('laatsteVerslagDatum', AppDateRangeType::class, [
                'required' => false,
            ]);
{'fraction_non_alphanumeric': 0.13700447835461935, 'fraction_numerical': 0.0006634599436059048, 'mean_word_length': 2.5680473372781063, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, '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': '6799550', 'n_tokens_mistral': 1788, 'n_tokens_neox': 1725, 'n_words': 242}