问题描述
|
我使用sfDoctrineGuard和自定义表MyProfile来管理我的Symfony项目中的用户。为了对我的项目实施密码重置功能,我决定安装sfForkedDoctrineApply。我编辑了MyProfile的架构,如下所示:
MyProfile:
...
inheritance:
type: column_aggregation
extends: sfGuardUserProfile
但是,我很沮丧地发现sfForkedDoctrineApply创建的sfGuardUserProfile表与sfDoctrineGuard创建的sfGuardUser表共享列(即名和姓的列)。
我的理解是,从插件更改架构是错误的形式,因为将来的插件更新可能会覆盖这些更改。因此,良好的做法是创建一个MyProfile表,并与sfGuardUser建立1对1的关系。
是否可以在不修改插件架构的情况下删除此列冗余,从而防止将来的更新破坏我的项目?哎呀,我认为最好在MyProfile中使用first_name和last_name列,而不要使用sfGuardUser!
如果有人有更好的主意,或者我所说的话有误,请告诉我!
谢谢大家
这是三个模式yml文件供参考:
MyProfile:
columns:
...
relations:
User:
class: sfGuardUser
local: user_id
foreign: id
type: one
foreignType: one
foreignAlias: Profile
inheritance:
type: column_aggregation
extends: sfGuardUserProfile
sfGuardUserProfile:
actAs:
Timestampable: ~
columns:
user_id:
type: integer
notnull: true
unique: true
email_new:
type: string(255)
unique: true
firstname:
type: string(255)
lastname:
type: string(255)
validate_at:
type: timestamp
validate:
type: string(33)
relations:
User:
class: sfGuardUser
foreign: id
local: user_id
type: one
onDelete: cascade
foreignType: one
foreignAlias: Profile
indexes:
validate:
fields: [validate]
sfGuardUser:
actAs: [Timestampable]
columns:
first_name: string(255)
last_name: string(255)
email_address:
type: string(255)
notnull: true
unique: true
username:
type: string(128)
notnull: true
unique: true
algorithm:
type: string(128)
default: sha1
notnull: true
salt: string(128)
password: string(128)
is_active:
type: boolean
default: 1
is_super_admin:
type: boolean
default: false
last_login:
type: timestamp
indexes:
is_active_idx:
fields: [is_active]
relations:
...
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)