【发布时间】:2013-11-08 17:59:54
【问题描述】:
我每天使用 Doctrine 将远程 CSV 导入 MySQL。远程 CSV 的主键位于架构的中心,而不是位于开头或结尾。
这似乎使得使用原则将这个“id”分配为主键成为不可能。为了匹配,我必须保留这个主键。
UKtradestransaction:
type: entity
repositoryClass: UktradesTransactionRepository
table: uktrades_transactions
fields:
owner_id:
type: integer
length: 9
nullable: true
security_id:
type: integer
length: 9
id: # THIS NEEDS TO BE THE PRIMARY KEY
type: integer
length: 12
exercise_price_uk:
type: decimal
length: 15
scale: 4
nullable: true
update_date:
type: date
nullable: true
id:
id: # THIS WILL NOT WORK
type: integer
length: 12
generator:
strategy:auto
由于最终的 id 字段与中心的 id 重复,因此上述操作无效。
如何将中间的“id”字段指定为主键?有没有办法将'id'字段定义为'fields'定义中的内联主键?
【问题讨论】:
标签: symfony doctrine-orm yaml