SonataDoctrineORMAdminBundle抛出array_combine错误

时间:2013-10-31 07:03:29

标签: symfony doctrine-orm sonata-admin symfony-sonata

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

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

有问题的管理类工作正常,直到使用composer将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与amount字段连接起来。两个表之间的每个连接必须是唯一的,从而强制使用组合键。

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

好像你错过了EntityTwo的表:

bundle\Entity\EntityTwo:
type: entity
table: entityTwo