关于学说2映射的问题Yaml

时间:2012-07-03 00:13:45

标签: php symfony1 doctrine doctrine-orm yaml

我正试图让这些映射正确但我似乎无法并且会喜欢一些建议......

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

我从架构验证工具得到的错误是:

  

[Mapping] FAIL - 实体类'Entities \ Item'映射无效:   *关联实体\项目#引用是指不存在的拥有方字段实体\引文#项目。

     

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

     

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

正如你所看到我有反面,为什么它没有看到它们?

1 个答案:

答案 0 :(得分:0)

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

ie:Entities \ Citation是否有商品属性? .. property $item;