我想进行多个分组。 例如:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$categorieRepo = $options['repo'];
$entreprise = $options['entreprise'];
$builder ->add('myCategories', EntityType::class, array(
'class' => Categorie::class,
'query_builder' => $categorieRepo->findCategorieQueryBuilder($entreprise, false),
'group_by' => function (Categorie $categorie) {
return is_null($categorie->getEntreprise()) ? null : $categorie->getEntreprise()->getNom();
},
'required' => true,
'choice_label' => function (Categorie $categorie) {
return $categorie->getNom();
},
))
}
我做了一个简单的分组