我正在尝试在 Doctrine 中建立一些关系
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”会正常工作......