Note that there are some explanatory texts on larger screens.

plurals
  1. POsymfony - custom form and updating records with embedForm
    primarykey
    data
    text
    <p>I'm having a small problem with <code>embedForm</code> using doctrine and SF1.4</p> <p>I have created an module, that a user can edit/create/delete users from a specific group using sfDoctrineGuard</p> <p>The form is simply a custom form named <code>manufacturerForm.class.php</code> and it extends <code>sfGuardUserAdminForm</code></p> <pre><code>class manaufacturerForm extends sfGuardUserAdminForm { public function configure() { $form = new sfGuardUserProfileForm(); $this-&gt;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 } } </code></pre> <p>You can see i am embedding the <code>sfGuardUserProfileForm</code> inside my <code>manufacturerForm</code>.</p> <p>I have 2 problems, the <code>sfGuardUserProfile</code> has fields that I don't want to display for this particular form, such as: <code>firstname, lastname, email_new, created_at, updated_at</code>, but I can't seem to unset them as they still display.</p> <p>Note, that this admin module does not have a <code>generator.yml</code> file. I'm doing all of this in <code>editSuccess.php</code> and using a <code>_form.php</code> partial.</p> <p>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:</p> <p><code>An object with the same "user_id" already exist.</code> - this is for the <code>user_id</code> field in sfGuardUserProfile, the same goes for the <code>email_new</code> field. I get <code>An object with the same "email_new" already exist.</code></p> <p>1) How do I unset the fields that I don't need?</p> <p>2) Do I need to overwrite any doSave(), updateObject(), saveEmbeddedForms() methods to stop the last problem?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload