(I originally posted my question here : http://stackoverflow.com/questions/5894570/how-to-deal-with-form-collection-on-symfony2-beta ?)
Hi! I have an entity User and an entity Address. There is a relation One- to-Many between User and Address : class User { /** * @orm:OneToMany(targetEntity="Address") */ protected $adresses; [...] } I have a class AddressType, and class UserType : class UserType extends AbstractType { public function buildForm(FormBuilder $builder, array $options) { $builder->add('addresses', 'collection', array('type' => new AddressType())); } [...] } In my controller, I build form with : $form = $this->get('form.factory')->create(new UserType()); ... and create view with : return array('form' => $form->createView()); I display form field in my twig template with : {{ form_errors(form.name) }} {{ form_label(form.name) }} {{ form_widget(form.name) }} [...] Okay. Now, how to display fields for one or more addresses ? (it's no {{ for_widget(form.adresses.zipcode) }} nor {{ for_widget(form.adresses[0].zipcode) }} ...) Any ideas ? -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en