Doctrine orm orm文件中的最后一个关系正在工作

Doctrine orm orm文件中的最后一个关系正在工作,doctrine-orm,doctrine,Doctrine Orm,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

我想在理论上建立一些关系

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
Amz\FinanceiroBundle\Entity\LancamentoConf:
类型:实体
表:amz_financeiro_lancamento_conf
身份证件:
身份证件:
类型:整数
生成器:{策略:自动}
领域:
活动:
类型:字符串
长度:1
...
许多人:
续:
目标:ContaConf
反演人:contajoinlancamentoconf
joinColumn:
名称:amz_financeiro_conta_conf_id
referencedColumnName:id
许多人:
中央客户:
目标实体:Amz\AmzBundle\Entity\CentroDeCustoConf
反演人:lancamentoconf
joinColumn:
名称:amz_centro_de_custo_conf_id
referencedColumnName:id
ContaConf.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
Amz\FinanceiroBundle\Entity\ContaConf:
类型:实体
表:amz_financeiro_conta_conf
身份证件:
身份证件:
类型:整数
生成器:{策略:自动}
领域:
活动:
类型:字符串
长度:1
...
一家公司:
contajoinlancamentoconf:
目标:兰开门托康
mappedBy:lancamentoconf
但只是“中心客户”关系在起作用


我注意到LancamentoConf.orm.yml中的最后一段关系是有效的。如果我先更改顺序(“centrodecusto”和“conta”再更改),则“centrodecusto”可以正常工作…

您的问题重复了多个部分,应该只有一个定义,在其中您可以定义多个元素:

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