0

Question is similar to this: How to debug a Symfony2 form?

The problem is - on posting data - the data is in $_POST array. Form has the fields and they even have some values.

After handleRequest - those values become nulls.

The form is big, its a lot of work now to minimize the code. I think other developers know where else to look for to see the problem.

I have tried looking in debug bar, but I don't see anything useful - just errors, one of them that field is not filled which is not true because it is in $_POST array.

Stepping inside handleRequest also sounds unproductive with many of those loops going on there and unclear code inside.

I have a problem with Symfony 3.4.

Alireza
  • 2,319
  • 2
  • 23
  • 35
Darius.V
  • 737
  • 1
  • 13
  • 29

1 Answers1

0

One of ways - check if you have not modified $request wrong way.

I needed to unset some data from request object

 if ($policyRef->getUser() !== null && $policyRef->getUser()->getHowDidYouHearAboutUs() !== null) {
            // this happens when existing account is signing up in checkout with oauth
            $postData = $request->request->all();
            unset($postData['checkout']['account_setup']['signup']['howDidYouHearAboutUs']);
            unset($postData['undefined']); // todo maybe in frontend unset?
            $request->request->set('checkout', $postData['checkout']);
        }

By stepping inside handleRequest with xdebug, found out that there is error that form contains extra field 'checkout'.

It was because at first I have done this:

 $request->request->set('checkout', $postData);

Probalby also in debug bar should have shown this, but I did not pay attention because there were few errors and I had focused on other fields.

Darius.V
  • 737
  • 1
  • 13
  • 29