【问题标题】:Symfony doctrine refclass: weirdSymfony 学说 refclass:奇怪
【发布时间】:2012-06-16 16:39:46
【问题描述】:

我对 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 相同。

我的架构有什么问题?

【问题讨论】:

    标签: orm doctrine symfony-1.4


    【解决方案1】:

    友谊关系是equal nest relation。您似乎缺少示例中的 equal: true 位显示。另外,你真的不需要在 refClass 中定义关系。

    【讨论】:

      猜你喜欢
      • 2012-06-11
      • 1970-01-01
      • 2016-03-31
      • 1970-01-01
      • 2016-02-04
      • 2018-06-22
      • 2011-06-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多