Skip to content

Instantly share code, notes, and snippets.

@benglass
Created October 12, 2012 01:17
Show Gist options
  • Save benglass/3876801 to your computer and use it in GitHub Desktop.
Save benglass/3876801 to your computer and use it in GitHub Desktop.
Symfony 2 Collection Form Type Showing Related Model Data
## in QcProjectType::buildForm
->add('projectTasks', 'collection', array(
'type' => new QcProjectTaskType()
))
## in view template
{% for project_task in form.projectTasks %}
{{ project_task.task.name }}
{{ form_widget(project_task.task) }}
{{ form_widget(project_task.status) }}
{{ form_widget(project_task.initials) }}
{{ form_widget(project_task.comments) }}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment