Pet*_*erB 5 schema doctrine symfony1 fixtures
有没有办法加载具有循环引用的灯具?作为一个例子,我有以下夹具:
BusinessEntityTeam:
Nicole_Team:
name: Nicole's Team
Manager: [Nicole]
Business: [ACMEWidgets]
sfGuardUser
Nicole:
first_name: Nicole
last_name: Jones
email_address: nicole@example.com
username: nicole
password: nicole
Groups: [Group_abc]
Team: [Nicole_Team]
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,Nicole_Team引用了Nicole ......但Nicole也引用了Nicole_Team.
当Manager不是必需列时,这是正常的(夹具已加载,但Manager为NULL),但现在要求加载夹具是不可能的.
我能看到的唯一解决方法是将Team关系放在自己的对象中(例如'Profile'),因此关系不再是循环的.
还有其他方法吗?每个用户都必须在一个团队中,但只有少数用户是团队经理.我对我的数据模型设计糟糕并有改进余地这一事实持开放态度.
这个怎么样:
BusinessEntityTeam:
Nicole_Team:
name: Nicole's Team
Business: [ACMEWidgets]
sfGuardUser
Nicole:
first_name: Nicole
last_name: Jones
email_address: nicole@example.com
username: nicole
password: nicole
Groups: [Group_abc]
Team: [Nicole_Team]
ManagerFor: [Nicole_Team]
Run Code Online (Sandbox Code Playgroud)
为了避免循环引用,您必须将关系放入一个模型中。
| 归档时间: |
|
| 查看次数: |
979 次 |
| 最近记录: |