开发者

sfDoctrineGuardPlugin relations with sfDoctrineApplyPlugin (delete and create users)

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


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜