I am new to Symfony forms and trying to figure out how to create a form with a hidden field that references the parent. For example, I have a list that has many-to-one relationships with contacts. When creating a new contact, he needs a hidden field with the identifier of the list to which the contact is added.
I am currently trying to embed a form ListIdTypein my form ContactType. The only field on the form ListIdTypeis the list identifier. This works well, because I can set the list to an empty communication object, and it will automatically populate the element in the form with the name contact[list][id](which is defined in the form ListIdType). The problem is that when I submit the form, I get an error that no element "id" or methed "setId ()" exists in the list class.
But I feel like I'm doing something wrong, but I can’t find the documentation to point me in the right direction.
source
share