Reputation: 127
My Problem: I cannot get an associated Entity to save using the entity field type or collection field type.
My Database Relations
Database Structure Description:
What I want to Achieve
On my edit 'Usage' form I want to display a dropdown box for each 'telephone number' that the 'Usage' already has attached to it.
Each dropdown box will list all the telephone numbers for that region, allowing the user to select a new telephone number
How I want to display my Usage Form
My Controller
My Entities
Form Type
Twig Template
ViewTransformer
My Problem: When I submit the form, nothing happens, the new telephone number I selected is not persisted.
Upvotes: 2
Views: 459
Reputation: 813
I think your problem is that in your Usage Entity, you don't cascade the persist operation. You should try this :
@ORM\OneToMany(targetEntity="Telephone", mappedBy="usage", cascade={"persist"})
Hope this helps
Upvotes: 2