This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

sfDoctrineGuard 5.0.0 Profile 2 many relation - problem

Questions relating to sfGuardPlugin or other user management plugins

sfDoctrineGuard 5.0.0 Profile 2 many relation - problem

by novax » Fri Aug 06, 2010 2:58 pm

Hi,

I try to make simple 2 many relation with sfGuardUserProfile. Everything looks fine, except the fact, that when I try to apply changes in users profile (using standard sfGuardUser module) module changes all fields exept "2-many list". When I manually set refClass table values with phpMyadmin I see changes in profile, including relations, but still can't change refClass table with sfGuardUser module.

No warnings, no errors, no notice, module just don't apply changes (only to refClass table).

Code is very simple and in my opinion should work well.


sfGuardUser schema.yml fragment (tables nv_set1, nv_set2 are in doctrine schema).

Code: Select all
sfGuardUserProfile:
  columns:
      id: { type: integer, primary: true, autoincrement: true }
      user_id: { type: integer, notnull: true, unique: true; }
      additional_info: { type: string(16000) }
      birth_date:  { type: timestamp, notnull: false }
      is_male: { type: boolean, notnull: true, default: 0 }
  relations:
    User:
      class: sfGuardUser
      local: user_id
      foreign: id
      type: one
      onDelete: CASCADE
      foreignType: one
      foreignAlias: Profile
    Set1:
      class: nv_set1
      local: user_id
      foreign: set1_id
      refClass: nv_user_2_set1
      foreignAlias: Profile
    Set2:
      class: nv_set2
      local: user_id
      foreign: set2_id
      refClass: nv_user_2_set2
      foreignAlias: Profile


nv_user_2_set1:
  columns:
     set1_id: {  type: integer, notnull: true }
     user_id: {  type: integer, notnull: true }
  relations:
    Set1:
      class: nv_set1
      local: set1_id
      foreign: id
      onDelete: CASCADE
    User:
      class: sfGuardUserProfile
      local: user_id
      foreign: id
      onDelete: CASCADE


nv_user_2_set2:
  columns:
    set2_id: {  type: integer, notnull: true }
    user_id: {  type: integer, notnull: true }
  relations:
    Set2:
      class: nv_set2
      local: set2_id
      foreign: id
      onDelete: CASCADE
    User:
      class: sfGuardUserProfile
      local: user_id
      foreign: user_id
      onDelete: CASCADE



User profile in sfGuardUserAdminForm.php

Code: Select all
class sfGuardUserAdminForm extends BasesfGuardUserAdminForm
{
   public function configure()
   {
   parent::configure();

   $profile_form = new sfGuardUserProfileForm($this->object->Profile);
   unset($profile_form['user_id']);
   $this->embedForm('Profile', $profile_form);

   }
}



...and generator.yml fragment

Code: Select all
   class: sfGuardUserAdminForm
   display:
     "User": [first_name, last_name, email_address, username, password, password_again, Profile ]


Did I miss something? I don't understand why it doesn't work.

Thanx in advance.
novax
Junior Member
 
Posts: 2
Joined: Fri Aug 06, 2010 10:48 am

Re: sfDoctrineGuard 5.0.0 Profile 2 many relation - problem

by joeri.cochuyt » Wed Dec 29, 2010 3:09 am

Did you find a solution for this? I'm encountering the same problem
joeri.cochuyt
Junior Member
 
Posts: 3
Joined: Tue Jul 06, 2010 5:57 pm

Re: sfDoctrineGuard 5.0.0 Profile 2 many relation - problem

by novax » Mon Jan 31, 2011 6:52 pm

joeri.cochuyt wrote:Did you find a solution for this? I'm encountering the same problem


No I haven't found a solution yet. Probably there is a bug in sfdoctroneguard plugin, but I still can't find it :/
novax
Junior Member
 
Posts: 2
Joined: Fri Aug 06, 2010 10:48 am

Re: sfDoctrineGuard 5.0.0 Profile 2 many relation - problem

by Turner » Thu Oct 13, 2011 3:15 pm

I solved it by moving embedForm section to be AFTER
$this->setWidgets(array(. Then it showed on the page. Makes no sense and
it was not mentioned in any of the tutorials as far as I cell phone spy software could tell.
Turner
Junior Member
 
Posts: 1
Joined: Thu Oct 13, 2011 3:09 pm

Re: sfDoctrineGuard 5.0.0 Profile 2 many relation - problem

by Aliraza03 » Wed Oct 01, 2014 9:44 am

I have also applied the same procedure and my problem solved. It helped me to backup my database too.
ali
Aliraza03
Junior Member
 
Posts: 1
Joined: Wed Oct 01, 2014 9:32 am