Hi, Stupid.. made a typo in my annotations.. could not map to a undefined property: profile_id, the name was profile.
Best regards, Michael Holm On Fri, May 27, 2011 at 2:02 PM, Michael Holm <ho...@hollo.dk> wrote: > Hi, > > I have a problem with embedded forms.. i get a notice: undefined index > profile_id.. > > I have a user form with embed a one-to-one relationship with a > profile, which embed a one-to-many relationship to profile_address.. > > If i just have the user relationship embedded with the profile, > everything works just fine.. but when i add the collection i get > problems.. hope that someone can help me.. > > This is the error message that i get: > > Notice: Undefined index: profile_id in > /var/www/clubmaster_v2/vendor/doctrine/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php > line > 1198 > > > class User extends AbstractType > { > public function buildForm(FormBuilder $builder, array $options) > { > $builder->add('member_number'); > $builder->add('profile', new \Club\UserBundle\Form\Profile()); > } > > public function getDefaultOptions(array $options) > { > return array( > 'data_class' => 'Club\UserBundle\Entity\User' > ); > } > } > > class Profile extends AbstractType > { > public function buildForm(FormBuilder $builder, array $options) > { > $builder->add('first_name'); > $builder->add('last_name'); > $builder->add('gender','choice',array( > 'choices' => array( > 'male' => 'Male', > 'female' => 'Female' > ) > )); > $builder->add('profile_address','collection', array( > 'type' => new \Club\UserBundle\Form\ProfileAddress() > )); > } > > public function getDefaultOptions(array $options) > { > return array( > 'data_class' => 'Club\UserBundle\Entity\Profile' > ); > } > } > > class ProfileAddress extends AbstractType > { > public function buildForm(FormBuilder $builder, array $options) > { > $builder->add('street'); > $builder->add('suburl'); > $builder->add('postal_code'); > $builder->add('city'); > $builder->add('state'); > $builder->add('country'); > $builder->add('contact_type','choice',array( > 'choices' => array( > 'home' => 'Home', > 'work' => 'Work' > ) > )); > $builder->add('is_default','hidden'); > } > > public function getDefaultOptions(array $options) > { > return array( > 'data_class' => 'Club\UserBundle\Entity\ProfileAddress' > ); > } > } > Best regards, > Michael Holm > -- 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