0

I'm trying to remove some fields from the form generated by sfDoctrineGuard. I don't care about the name or email of my users, I just want them to have an username and a password.

alt text

I've tried editing /lib/form/doctrine/sfDoctrineGuardPlugin/sfGuardUserForm.class.php :

class sfGuardUserForm extends PluginsfGuardUserForm
{
  public function configure()
  {
    unset(
      $this['first_name'],
      $this['last_name'],
      $this['email_adress']
    );


  }
}

But that did nothing. Am I editing the right file ?

EDIT The only way I can make those fields disappear is by editing the file in the /plugins/ directory !

plugins/sfDoctrineGuardPlugin/lib/form/doctrine/sfGuardUserAdminForm.class.php

Manu
  • 4,410
  • 6
  • 43
  • 77

2 Answers2

2

Its probably using sfGuardUserAdminForm rather than sfGuardUserForm - check the view tab of the debug bar and it should tell you.

This class lives in the plugin, so you should subclass it under your project's lib/form folder and copy your existing configure method to the subclass.

You can then tell it to use this form by editing gnerator.yml - again, copy it to your project/application's modules folder from the plugin if you haven't already. You need to change generator/param/config/form/class. You also need to remove the fields from the form/display key if they are there, or it'll complain they don't exist.

benlumley
  • 11,370
  • 2
  • 40
  • 39
-2

These fields are configured in generator.yml file. But removing there will not work as you expected. You need to manually remove these fields from schema.yml, form- and model classes.

Darmen Amanbay
  • 4,869
  • 3
  • 29
  • 50
  • I just want to hide them in the form, they can still be in the database, I don't care. – Manu Oct 15 '10 at 12:33
  • I don't have a generator.yml to edit, it is in the plugin folder – Manu Oct 15 '10 at 14:20
  • @benlumbey ok, does symfony provide a way to customize plugin schemas? – Darmen Amanbay Oct 16 '10 at 09:10
  • i don't think it does no - only editing the core files, which is bad as it means you can't upgrade so easily. Bit of a nuisance at times. You can half get there by copying/duplicating bits of schema.yml, but its not great. – benlumley Oct 18 '10 at 15:24