Search code examples
phpsymfonyangularput

Symfony 3 bind data to form from request


I have a small question, how should I bind PUT request in symfony to form, if Request is empty.

Even if I get access to data with

file_get_contents("php://input")

I have got incorrect structure to bind data and $form->handleRequest will not work as expected. There is no form name and hierarchy is not observed. I get an object of post from angular interface.


Solution

  • In that case, you submit the data to form directly, which in essence is done within handleRequest() call.

    The official docs says how to do it: Calling Form::submit() manually

    If need be you could even "submit" all the fields individually, but that is very unlikely to happen to anyone.

    Hope this helps...