Symfony doctrine refclass:很奇怪

时间:2012-06-16 16:39:47

标签: orm doctrine symfony-1.4

我对refClass关系有一个奇怪的行为:

User:
 [.....]
MyFriends: {class: User, refClass: UserFriend, local: id_owner, foreign: id_friend, type: many}

UserFriend:
  columns:
    id_owner: {type: integer(8)}
    id_friend: {type: integer(8)}
  relations:
    Owner: {class: User, local: id_owner, foreign: id, type: one}
    Friend: {class: User, local: id_friend, foreign: id, type: one}

其中id_owner是朋友关系的“所有者”,id_friend是朋友。 但是,当我尝试获取$user->getMyFriends()时,我会得到与$user相同的结果。

我的架构有什么问题?

1 个答案:

答案 0 :(得分:0)

友谊关系是equal nest relation。您似乎错过了示例中的equal: true位显示。另外,您实际上不需要在refClass中定义关系。