First I\'ve read documents for both Collection Field Type and How to Embed a Collection of Forms ... The example is about one entity (Task) that has one-to-many relation wit
Here's a start on a possible solution. The example below takes a single entity Skills and presents all of them on a single page. What I don't know is whether this technique can be used to persist children objects. I would expect one could loop through the returned data and persist as required.
The code below results in a page with a list of all possible Skills and a checkbox for declaring each enabled or enabled.
In a controller:
$skills = $em->getRepository("TruckeeMatchingBundle:Skill")->getSkills();
$formSkills = $this->createForm(new SkillsType(), array('skills' => $skills));
...
if ($request->getMethod() == 'POST') {
$formSkills->handleRequest($request);
foreach ($skills as $existingSkill) {
$em->persist($existingSkill);
}
}
...
return ['formSkills' => $formSkills->createView(),...]
In a template:
{% for skill in formSkills.skills %}
{{ skill.vars.value.skill }}