2013-03-11 48 views
0

我試圖做一些關係,原則剛剛過去的一個教義.orm文件關係工作

LancamentoConf.orm.yml:

Amz\FinanceiroBundle\Entity\LancamentoConf: 
    type: entity 
    table: amz_financeiro_lancamento_conf 
    id: 
    id: 
     type: integer 
     generator: { strategy: AUTO } 
    fields: 
    active: 
     type: string 
     length: 1 
    ... 
    manyToOne: 
    conta: 
     targetEntity: ContaConf 
     inversedBy: contajoinlancamentoconf 
     joinColumn: 
     name: amz_financeiro_conta_conf_id 
     referencedColumnName: id 
    manyToOne: 
    centrodecusto: 
     targetEntity: Amz\AmzBundle\Entity\CentroDeCustoConf 
     inversedBy: lancamentoconf 
     joinColumn: 
     name: amz_centro_de_custo_conf_id 
     referencedColumnName: id 

ContaConf.orm.yml:

Amz\FinanceiroBundle\Entity\ContaConf: 
    type: entity 
    table: amz_financeiro_conta_conf 
    id: 
    id: 
     type: integer 
     generator: { strategy: AUTO } 
    fields: 
    active: 
     type: string 
     length: 1 
    ... 
    oneToMany: 
    contajoinlancamentoconf: 
     targetEntity: LancamentoConf 
     mappedBy: lancamentoconf 

但只是 「centrodecusto」 關係的工作...

我注意到算了筆他在LancamentoConf.orm.yml中的最後一個關係工作。如果我更改順序(「centrodecusto」第一和「conta」第二),「centrodecusto」將工作正常...

回答

0

你問題是重複manyToOne節,應該只有一個定義,並且你可以定義幾個要素:

LancamentoConf.orm.yml:

Amz\FinanceiroBundle\Entity\LancamentoConf: 
    type: entity 
    table: amz_financeiro_lancamento_conf 
    id: 
    id: 
     type: integer 
     generator: { strategy: AUTO } 
    fields: 
    active: 
     type: string 
     length: 1 
    ... 
    manyToOne: 
    conta: 
     targetEntity: ContaConf 
     inversedBy: contajoinlancamentoconf 
     joinColumn: 
     name: amz_financeiro_conta_conf_id 
     referencedColumnName: id 
    centrodecusto: 
     targetEntity: Amz\AmzBundle\Entity\CentroDeCustoConf 
     inversedBy: lancamentoconf 
     joinColumn: 
     name: amz_centro_de_custo_conf_id 
     referencedColumnName: id 
+0

@ user2157786:請接受它,如果它爲你工作。 – 2013-03-15 21:24:08