add( 'title', TextType::class, [ 'label' => 'Titre', 'required' => false, 'attr' => [ ], 'constraints' => [ ], ] ); $builder->add( 'contentFormat', ChoiceType::class, [ 'label' => 'Format', 'required' => false, 'choices' => [ 'HTML' => 'html', 'Markdown' => 'markdown', ], 'constraints' => [ ], ] ); $builder->add( 'category', EntityType::class, [ 'label' => 'Catégories', 'class' => Category::class, 'choice_label' => 'title', 'choice_value' => 'id', 'required' => false, 'attr' => [ ], 'query_builder' => function (EntityRepository $repo) { return $repo->createQueryBuilder('a') ->orderBy('a.title', 'ASC') ; }, 'constraints' => [ ], ] ); $builder->add( 'status', ChoiceType::class, [ 'label' => 'Statut', 'required' => false, 'choices' => [ 'Brouillon' => 0, 'Publié' => 1, ], 'attr' => [ ], 'constraints' => [ ], ] ); $builder->add( 'isQuick', ChoiceType::class, [ 'label' => 'Quick', 'required' => false, 'choices' => [ 'Anyway' => null, 'Yes' => true, 'No' => false, ], 'attr' => [ ], 'constraints' => [ ], ] ); } public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'data_class' => null, 'csrf_protection' => false, ]); } }