I've read this article (http://welcometothebundle.com/symfony2-rest-api-the-best-2013-way/) to build my system REST API with Symfony2. Following the guide, i no longer use Symfony2 Form as web form but only 2 main job: map data into Entity and Validation. In my view, i'm using AngularJS to call REST API with the help from its good built-in services.
In my case, I want to update my entity, AngularJS will get JSON data which serialized from entity and set back to $scope.object to bind to form. For example:
{
email: "[email protected]"
id: 22
party: {
id:24,
lastName: Gates,
firstName: Bill
}
}
Make some change then send $scope.object to update route with PUT method, I will use Symfony2 form and submit this data, but Symfony2 form validation keep throwing exception This form should not contain extra fields.. I know id field is not a form field but don't know how to make Symfony to ignore all these extra fields. Can you help me?