0

I try to add a default option to an entity field in Symfony 2.3 form builder :

->add('destinataire','directory', array(
                                            'required' => true, 
                                            'class'=> 'MLCUserBundle:Departement',
                                            'multiple' => false,
                                            'query_builder' => function (EntityRepository $er) use ($options) {
                                                $data = $er->createQueryBuilder('d')
                                                          ->where('d.id IN (:liste)')
                                                          ->setParameter('liste',$options['listeId'])
                                                          ->orderBy('d.name', 'ASC')
                                                        ;
                                                return $data;
                                            },
                                            'empty_data'  => $all,
                                            'choices' => $all,
                                            )
           )

without success I need some help! thx all !

5

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.