0

Symfonyのプロジェクトバージョンを2.1から2.2RC2にアップグレードしたところ、2.1では表示されなかったマッピングエラーが表示され始めました。私のマッピング全体がエラーをスローするようです。例があります:

これらは私の2つのエンティティです。

1.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.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\Entity \ Usuario#historicosは、アソシエーションとして定義されていない所有側フィールドMyBundle \ Entity \ Historyico#idを参照します。

関連付けMyBundle\Entity \ Usuario#historicosは、存在しない所有側フィールドMyBundle \ Entity \ Historyico#idを参照します。

私の以前のcomposer.json(バージョン2.1から、すべてが正常に機能していた)には、次のバージョンのドクトリンがありました。

[...]
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.0.*",
[...]

また、Symfony 2.2 RC2には、次のバージョンのDoctrineが付属しています。

[...]
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "1.2.*",
[...]

何が間違っているのかわかりません。Doctrineのマッピングドキュメントに表示されるすべてのものとほとんど同じように見えます。誰かが私を正しい方向に向けることができれば、それは素晴らしいことです。

4

1 に答える 1

2

検証エラーは正しいです。

それには何も問題はありません。メタデータがロードされたときにもそのような例外をキャッチするようにDoctrineのランタイムバリデーターを改善しただけです。

YAMLを実際に変更する方法は次のとおりです。

MyBundle\Entity\Usuario:
    [...]
    oneToMany:
        historicos:
            targetEntity: Historico
            mappedBy: coUsuario
    [...]

基本的に、正しいフィールドを指すようにoneToMany関連付けプロパティを修正しました。mappedBy

于 2013-02-15T22:29:50.067 に答える