-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Rendering of the form panel of the profiler breaks due to data.id being undefined #29291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
note that it does not happen each time. I had one case with a displayed form which worked, while another profile with a submitted form (same form) broke. |
Tried to reproduce, without any luck so far. Looking at code there should always be an id set 🤔
Do you have some hints about the form structure. Does it happen on the root- or a child-form? |
I have a CollectionType in this form. The missing id happens for the first element in this collection. I think this is related to the fact that the fields are added in a PRE_SUBMIT listener. Maybe |
For public function __invoke(FormFactoryInterface $f, Request $r)
{
$form = $f->createBuilder();
$form->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $e) {
$e->getForm()->add('coll', CollectionType::class, ['data' => ['foo']]);
});
$form->add('submit', SubmitType::class);
$form = $form->getForm();
$form->handleRequest($r);
return $this->render('index.html.twig', ['form' => $form->createView()]);
} After submit i see Nevertheless, this code looks related: The first $output variable is ignored here. |
I'm not adding the collection type itself in a PRE_SUBMIT. But the collection type itself adds new children here. |
We ran into this bug too. Not sure what's causing it, but this does reproduce the issue: |
Fixed in #33999 |
Symfony version(s) affected: 3.4.18
Description
The macro
form_tree_details
andform_tree_entry
usesdata.id
in a lot of places. Some of them check for it to be defined, but some others don't. And I got a case where it fails:How to reproduce
I don't have a standalone reproducer for now.
The text was updated successfully, but these errors were encountered: