symfony:尝试为修改后的“id”赋值;场地
我试图为字段 id 赋予不同的属性(正如您所知,如果您编写“id:~”),字段 id 是可自动递增的并且是主键)。
所以我写了这个:
nations:
primary_key: { type: INTEGER, size: 5, required: true, primaryKey: true}
id: { type: INTEGER, size: 5, required: true, primaryKey: false}
name: { type: VARCHAR, size: 64 }
iso_code_2: { type: CHAR, size: 2 }
iso_code_3: { type: CHAR, size: 2 }
但是当我尝试加载下面的这个夹具时,我得到这个错误:
Cannot insert a value for auto-increment primary key (nations.ID)
这是夹具:
Nations:
france:
id: '74'
iso_code_2: FR
iso_code_3: fr
那么有什么方法可以强制加载这个夹具?
sf 1.4/propel
问候
哈维
I'm trying to give different attributes to the field id (as you know if you write "id: ~") the field id is autoincrementable and a primary key).
So I have write this:
nations:
primary_key: { type: INTEGER, size: 5, required: true, primaryKey: true}
id: { type: INTEGER, size: 5, required: true, primaryKey: false}
name: { type: VARCHAR, size: 64 }
iso_code_2: { type: CHAR, size: 2 }
iso_code_3: { type: CHAR, size: 2 }
But when i try to load this fixture below i get this error:
Cannot insert a value for auto-increment primary key (nations.ID)
This is the fixture:
Nations:
france:
id: '74'
iso_code_2: FR
iso_code_3: fr
So any way to force the loading of this fixture?
sf 1.4/propel
Regards
Javi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有趣的。以下内容适用于 1.4/Propel,但这确实使用 ID(非自动增量)作为 PK。事实上,您的错误将 Nations.ID 称为 PK 字段,这听起来像是一个错误。
Interesting. The following works for me in 1.4/Propel, but this does use ID (non-autoincrement) as PK. The fact that your error calls nations.ID a PK field makes it sound like a bug.