setRequired(true) ->setChoices( [ 'Lundi' => 1, 'Mardi' => 2, 'Mercredi' => 3, 'Jeudi' => 4, 'Vendredi' => 5, 'Samedi' => 6, 'Dimanche' => 7, ] ), TimeField::new('timeStart') ->setRequired(false) ->setFormat('H:mm'), TimeField::new('timeEnd') ->setRequired(false) ->setFormat('H:mm'), AssociationField::new('groupUser'), ], $fields ); } public function configureCrud(Crud $crud): Crud { $crud = parent::configureCrud($crud); $crud->setDefaultSort(['day' => 'ASC']); return $crud; } public function createEntity(string $entityFqcn) { $factory = new OpeningFactory(); $currentSection = $this->get('section_resolver')->getCurrent(); return $factory->create($currentSection); } }