I'm having a small problem with embedForm
using doctrine and SF1.4
I have created an module, that a user can edit/create/delete users from a specific group using sfDoctrineGuard
The form is simply a custom form named manufacturerForm.class.php
and it extends sfGuardUserAdminForm
class manaufacturerForm extends sfGuardUserAdminForm
{
public function configure()
{
$form = new sfGuardUserProfileForm();
$this->embedForm('profile', $form);
unset($this['firstname'], //this field is in sfGuardUserProfile is shown in form
$this['user_id'], //this field is in sfGuardUserProfile is shown in form
$this['is_super_admin'], //this field is in sfGuardUser is not shown
$this['is_admin'], // this filed is in sfGuardUser is not shown
$this['permissions_list'], //this field is in sfGuardUser is not shown
$this['groups_list']);//this field is in sfGuardUser is not shown
}
}
You can see i am embedding the sfGuardUserProfileForm
inside my manufacturerForm
.
I have 2 problems, the sfGuardUserProfile
has fields that I don't want to display for this particular form, such as:
firstname, lastname, email_new, created_at, updated_at
, but I can't seem to unset them as they still display.
Note, that this admin module does not have a generator.yml
file. I'm doing all of this in editSuccess.php
and using a _form.php
partial.
My other problem is, when I edit an existing user and save all is well. The problem comes with when I try to edit as I get the following:
An object with the same "user_id" already exist.
- this is for the user_id
field in sfGuardUserProfile, the same goes for the email_new
field. I get An object with the same "email_new" already exist.
1) How do I unset the fields that I don't need?
2) Do I need to overwrite any doSave(), updateObject(), saveEmbeddedForms() methods to stop the last problem?
Thanks