symfony2 Sending options to a form class How the custom options are used in the form class


Example

        ->add('housing', EntityType::class,
            array(
            'class' => 'AppBundle:Housing',
            'choice_label' => 'housing',
            'placeholder' => '',
            'attr' => (in_array('Housing', $options['disabledOptions']) ? ['disabled' => 'disabled'] : []),
            'label' => 'Housing: ',
            'query_builder' => function (EntityRepository $er) use ($options) {
                if (false === in_array('Housing', $options['disabledOptions'])) {
                    return $er->createQueryBuilder('h')
                        ->orderBy('h.housing', 'ASC')
                        ->where('h.enabled=1');
                } else {
                    return $er->createQueryBuilder('h')
                        ->orderBy('h.housing', 'ASC');
                }
            },
        ))