Description
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Form.php#L539
This is currently
$child->bind(isset($submittedData[$name]) ? $submittedData[$name] : null);
Yes, this is compliant with HTTP 1.1, however, it reveals a philosophical problem when implementing REST. For example...
I have a User Entity that has a username, a password, and a one-to-many relationship with Friend Entities. I would like to update a User Entity's password, but according to this approach, if I was to do a PUT on the Entity itself, not only would I have to submit the password, but if this user has 300 friends, I have to submit all 300 friends as well or else Symfony will set the friends to NULL.
This is sort of crazy. Again, I understand form builder generates an HTML form for the user to integrate into a Twig template, but again, this is REST. There is no HTML form to obfuscate this intended functionality. Therefore, I propose that Symfony's default behavior when dealing with unsubmitted form properties is to rely on the previous entities data. This can be done by doing the following:
$child->bind(isset($submittedData[$name]) ? $submittedData[$name] : $child->modelData);
I've tested this and it only fails with EntityType. I can fix that if this is seriously considered.