我剛剛將Symfony的項目版本從2.1升級到2.2 RC2,並開始看到一些映射錯誤沒有出現在2.1上。我的整個映射似乎會引發錯誤。有一個例子:升級到Symfony 2.2 RC2導致映射錯誤
這些是我的兩個實體。
1.
MyBundle\Entity\Usuario:
type: entity
table: usuario
id:
id:
type: integer
generator: { strategy: AUTO }
column: co_usuario
fields:
[...]
oneToMany:
historicos:
targetEntity: Historico
mappedBy: id
[...]
2.
MyBundle\Entity\Historico:
type: entity
table: historico
id:
id:
type: integer
generator: { strategy: AUTO }
column: co_historico
fields:
[...]
manyToOne:
coUsuario:
targetEntity: Usuario
inversedBy: historicos
joinColumn:
name: co_usuario
referencedColumnName: co_usuario
[...]
這些都是我得到的錯誤:
協會MyBundle \實體\ Usuario#historicos指 擁有方字段MyBundle \ Entity \ Historico#id未定義爲 關聯。
協會MyBundle \ Entity \ Usuario#historicos將 指向擁有方的字段MyBundle \ Entity \ Historico#id,其中不存在 。
我以前composer.json(從2.1版本,在一切都很好工作)有這些版本的學說:
[...]
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.0.*",
[...]
而且Symfony的2.2 RC2附帶這些版本的教義:
[...]
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "1.2.*",
[...]
我不確定我做錯了什麼,它看起來非常像我們在doctrine的映射文檔中看到的一切。如果有人能指引我走向正確的方向,那會很棒。