【问题标题】:sfDoctrineGuardPlugin relations with sfDoctrineApplyPlugin (delete and create users)sfDoctrineGuardPlugin 与 sfDoctrineApplyPlugin 的关系(删除和创建用户)
【发布时间】:2011-05-24 04:54:19
【问题描述】:

我使用 symfony 1.4.11。我使用 sfDoctrineGuardPlugin 和 sfDoctrineApplyPlugin.All 工作正常,但是...... ,或者当我从后端删除用户时,它仅从 sf_guard_user 表中删除了他的个人资料,但它不会从 sf_guard_user_profile 表中删除他的个人资料...那么如何解决是吗?也许我在配置两个插件时都犯了错误?谢谢!

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

【问题讨论】:

    标签: symfony-1.4 sfdoctrineguard sfguard symfony-plugins


    【解决方案1】:

    只需将我的数据库从 MyISAM 更改为 INNODB,一切正常!

    【讨论】:

      【解决方案2】:

      关于创建新用户 - 首先我不确定这两个插件中是否有这样的功能。 (至少我不知道)。

      关于从 sf_guard_user_profile 表中删除用户和相关数据 - 我认为关系定义很可能存在一些问题。在定义 sf_guard_user_profile 表的安装部分再次检查 sfDoctrineApplyPlugin 自述文件。您需要为用户关系设置 onDelete: cascade

      最后检查是否生成了正确的 sql 并将其应用于数据库架构。

      问候。

      【讨论】:

      • 我添加了我的架构...我尝试使用this 方法,但是,它是添加所有数据,但是 user_id = 0 ((
      • 请解释一下你想要完成什么?因为您评论中链接中描述的 sfDoctrineApplyPluginProfile 模块的功能并不相同: - sfDoctrineApplyPlugin 允许站点的用户创建/请求新帐户。 - Profile 模型已创建并与 sfDoctrineGuardPlugin 相关,以便包含一些附加信息。
      • @Mihail Dimitrov 我有 sfDoctrineApplyPlugin,用户可以在网站上注册,每个人都有自己的个人资料。sfDoctrineApplyPlugin 用于帐户 sf_guard_user_profile表,但我也希望能够从后端添加/编辑用户帐户。而且这种方法有效,我可以编辑用户个人资料信息,并创建新用户。现在我有两个问题......1.当我从后端用户 ID=0。 2.当我从后端删除用户时,他在sf_guard_user_profile中的个人资料没有删除。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-03
      • 2011-10-21
      相关资源
      最近更新 更多