Symfony Edit Specific Related Records
I have an app that I have a model that supports multiple add开发者_开发知识库resses, but upfront I only want to allow the user to add/edit one address.
User
----
UserId
Address
----
UserId
Line1
...
I have the following to render the form for adding a new address, but how about existing records? What do I need to add to my configure method in the User form?
$this->embedForm("address", new AddressForm());
Take a look at More with Symfony: Advanced Forms. This chapter outlines a good way to embed multiple forms when dealing with 1-to-many relationships and should more than cover explaining what you need to do.
精彩评论