2013-03-11 45 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