1

I've added a profile class to sfDoctrineGuard, and in the admin I'm trying to edit the profile part while editing the user, using embed forms as explained here:

http://www.symfony-project.org/blog/2008/11/12/call-the-expert-customizing-sfdoctrineguardplugin alt text

Editing users works, but when I add

"User": [username, password, password_again, Profile]

All I get is an error message :

Widget "Profile" does not exist.

Any help would be appreciated. Is the blog post out of date ?

Manu
  • 4,410
  • 6
  • 43
  • 77
  • $this->embedRelation('Profile') does nothing, as soon as I add 'profile' to generator.yml, sf tells me that it doesn't know the widget 'profile' – Manu Oct 18 '10 at 07:28
  • 1
    I had lots of other problems, but one of them was that sf makes a difference between "profile" and "Profile" :D – Manu Oct 18 '10 at 08:59
  • So to answer my own question, the blogpost is not out of date, the method explained still works. – Manu Oct 18 '10 at 15:19

1 Answers1

2

There's a nice neat way to do this now.... Are you using 1.3 or 1.4?

In UserForm:

public function configure()
{
    $this->embedRelation('Profile');
}

Assuming that your schema is set up correctly, this will embed the form.

Darragh Enright
  • 13,676
  • 7
  • 41
  • 48
  • I've added the line to configure() of /lib/form/doctrine/sfDoctrineGuardPlugin but it doesn't appear to change anything to the form. No error messages either. – Manu Oct 15 '10 at 09:34
  • Thanks to whoever downvoted me. Next time a reason would be nice... @Manu - You are embedding the Profile form into your User form, so you should add this line to your UserForm class. I suspect that you might have an issue with your schema if this does not work. Have a look and make sure everything is in order. – Darragh Enright Oct 15 '10 at 13:27
  • I may have something wrong in my schema, but in the fixtures I can edit the "profile" part as I edit the "sfUserGuard" part. – Manu Oct 15 '10 at 14:28
  • $this->embedRelation('Profile'); does nothing, sf keeps telling me that it doesn't know the widget 'profile' – Manu Oct 16 '10 at 15:41