0

I use symfony 1.4.11. I use sfDoctrineGuardPlugin and sfDoctrineApplyPlugin.All works fine, but... In my backend I have user list, where I can manage users.When I create new user from backend, his profile create only in sf_guard_user table, or when I delete user from backend , it deleted his profile only from sf_guard_user table, , but it do not delete his profile from sf_guard_user_profile table...So how to fix it?Maybe I am made something wrong in cofiguration of both plugins? Thank you!

sfGuardUserProfile:
  connection: doctrine
  tableName: sf_guard_user_profile
  columns:
    id:            { type: integer(4), primary: true, autoincrement: true }
    user_id:       { type: integer(4), notnull: true , primary: false }
    salutation:    { type: string(10), notnull: true }
    first_name:    { type: string(30), notnull: true }
    last_name:     { type: string(30), notnull: true }
    country:       { type: string(255), notnull: true }
    postcode:      { type: string(10) , notnull: true }
    city:          { type: string(255), notnull: true }
    address:       { type: string()   , notnull: true }
    phone:         { type: string(50) }
    email:         { type: string(255), notnull: true }
    validate:      { type: string(17) }
    banned:        { type: boolean, default: 0 }
    payed_until:   { type: datetime, notnull: true}
  relations:
    User:
      class: sfGuardUser
      foreign: id
      local: user_id
      type: one
      onDelete: cascade
      foreignType: one
      foreignAlias: Profile
denys281
  • 2,004
  • 2
  • 19
  • 38

2 Answers2

1

Just change my database from MyISAM to INNODB and all works fine!

Brian Webster
  • 30,033
  • 48
  • 152
  • 225
denys281
  • 2,004
  • 2
  • 19
  • 38
0

About creating new user - I'm not sure if there is such a feature in both plugins in the first place. (At least I don't know about it).

About deleting user and related data from sf_guard_user_profile table - I think that most likely there is some problem with relations definition. Check the sfDoctrineApplyPlugin readme again in the installation section where the sf_guard_user_profile table is defined. You need to have onDelete: cascade set for the User relation.

And at the end check if the proper sql was generated and applied to the database schema.

Regards.

Mihail Dimitrov
  • 574
  • 3
  • 9
  • I add my schema... I try to use [this](http://www.symfony-project.org/blog/2008/11/12/call-the-expert-customizing-sfdoctrineguardplugin) method, but ,it is add all data, but user_id = 0 (( – denys281 Jun 03 '11 at 20:43
  • Please, explain what are you trying to accomplish? Because the functionality of **sfDoctrineApplyPlugin** and **Profile** module described in the link in your comment is not the same: - **sfDoctrineApplyPlugin** allows users of a site to create/request new accounts. - **Profile** model is created and related to **sfDoctrineGuardPlugin** in order to include some additional information. – Mihail Dimitrov Jun 03 '11 at 21:21
  • @ Mihail Dimitrov I have **sfDoctrineApplyPlugin**,users can register on the site,each of them have own profile.[sfDoctrineApplyPlugin](http://goo.gl/2cZ7I) use for accounts **sf_guard_user_profile** table,but I also want to be able to add/edit users accounts from backend.And this method works,I can edit user profile information,and create new users.Now I have two problems...1.When I add user from backend user_id=0. 2.When I delete user from backend,his profile in **sf_guard_user_profile** do not delete. – denys281 Jun 03 '11 at 21:39