Reputation: 1010
I'm trying to switch over from building forms with annotations to just writing them myself. I have an entity and a form that you can see here.
The code in my controller is pretty straightforward: get an instance of the user form and an empty user entity, bind the entity to the form, validate, blah blah blah.
For the most part, this is working. When I dump the user entity after validating the form, the first name, last name, and email address are all filled with the correct values. The sex, however, is still null. Yet when I check the post data, the value for sex is in there.
Is there something I'm missing in either my form or my entity? I have a getSex method in my user entity. Just for kicks and giggles, I even tried echoing output from all of the setters to see what was going on. When the form was validated, I could see the output from all the setters, except for getSex.
Upvotes: 1
Views: 337
Reputation: 1010
OK, I figured out what happened. For the binding to work properly, the form has to have an input filter for each item; anything without one gets ignored. Once I added an input filter to the sex element, everything was just fine.
Upvotes: 2