我有一个多对多关系,它发出警告:
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。两个表之间的每个连接都必须是唯一的,从而强制键是复合的。
有什么想法吗?
最佳答案
您似乎错过了 EntityTwo 的表格:
bundle\Entity\EntityTwo:
type: entity
table: entityTwo
关于symfony - SonataDoctrineORMAdminBundle 抛出 array_combine 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19700240/