2

我有一个多对多的关系,它会发出警告:

Warning: array_combine(): Both parameters should have an equal number of elements in vendor/sonata-project/doctrine-orm-admin-bundle/Sonata/DoctrineORMAdminBundle/Model/ModelManager.php line 179

有问题的管理类工作正常,直到使用作曲家将 SonataDoctrineORMAdminBundle 更新到 2.2.4 版。

我认为问题可能出在我的模型上,但不确定是什么。

bundle\Entity\EntityOne:
    type: entity
    table: entityOne

    fields:
        id:
            type: integer
            id: true
            generator:
                strategy: AUTO
        title:
            type: string
            length: '100'

    oneToMany:
        entityRel:
            targetEntity: EntityRel
            mappedBy: entityOne
            cascade: ["persist", "remove"]

    lifecycleCallbacks: {  }



bundle\Entity\EntityRel:
    type: entity
    table: entityRel
    id:
        entityOne:
            associationKey: true
        entityTwo:
            associationKey: true
    fields:
        amount:
            type: decimal
    oneToOne:
        entityOne:
            targetEntity: EntityOne
        entityTwo:
            targetEntity: EntityTwo
    lifecycleCallbacks: {  }



bundle\Entity\EntityTwo:
    type: entity
    table: entityTwo
    fields:
        id:
            type: integer
            id: true
            generator:
                strategy: AUTO
        name:
            type: string
            length: '100'

    oneToMany:
        entityRel:
            targetEntity: entityRel
            mappedBy: entityTwo
            cascade: ["persist", "remove"]

    lifecycleCallbacks: {  }

这个想法是 EntityRel 将 EntityOne 和 EntityTwo 与金额字段连接起来。两个表之间的每个连接都必须是唯一的,从而强制组合键。

任何想法?

4

1 回答 1

2

It seems like you miss the EntityTwo's table:

bundle\Entity\EntityTwo:
type: entity
table: entityTwo
于 2013-11-08T08:44:42.770 回答