0

我正在努力使这些映射正确,但我似乎无法并且希望得到一些建议......

Entities\User:
  type: entity
  oneToMany:
    citations:
      targetEntity: Citation
      mappedBy: user
      cascade: ["all"]

Entities\Citation:
  type: entity
  manyToOne:
    item:
      targetEntity: Item
      inversedBy: citations
      joinColumn:
        name: item_id
        referencedColumnName: id
  manyToOne:
    user:
      targetEntity: User
      inversedBy: citations
      joinColumn:
        name: user_id
        referencedColumnName: id


Entities\Item:
  type: entity
  oneToMany:
    authors:
      targetEntity: Author
      mappedBy: item
      cascade: ["all"]
  oneToMany:
    citations:
      targetEntity: Citation
      mappedBy: item


Entities\Author:
  type: entity
  manyToOne:
    item:
      targetEntity: Item
      inversedBy: authors

我从模式验证器工具得到的错误是:

[映射] FAIL - 实体类 'Entities\Item' 映射无效: * 关联 Entities\Item#citations 指的是不存在的拥有方字段 Entities\Citation#item。

[映射] FAIL - 实体类 'Entities\Citation' 映射无效: * 关联 Entities\Citation#user 指的是不存在的反向侧字段 Entities\User#citations。

[映射] FAIL - 实体类 'Entities\Author' 映射无效: * 关联 Entities\Author#item 指的是不存在的反边字段 Entities\Item#authors。

如您所见,我有反面,为什么看不到它们?

4

1 回答 1

0

您是否在类上创建了相关属性(在 php 文件中)?

即: Entities\Citation 是否有项目属性?..property $item;

于 2012-07-06T00:15:40.933 回答