我使用symfony 1.4與教條作爲我的ORM,我需要做兩件事情之一來讓它工作,我不知道該怎麼做。如何在教義中定義自動增量id列?
ID字段不應該是BIGINT,只是int或
當我定義我的表如下:
Table: columns: id: type: integer autoincrement: true primary: true
使自動增量的工作,因爲如果我定義我的ID像這樣它不會自動增加它。
我使用symfony 1.4與教條作爲我的ORM,我需要做兩件事情之一來讓它工作,我不知道該怎麼做。如何在教義中定義自動增量id列?
ID字段不應該是BIGINT,只是int或
當我定義我的表如下:
Table:
columns:
id:
type: integer
autoincrement: true
primary: true
使自動增量的工作,因爲如果我定義我的ID像這樣它不會自動增加它。
如果您沒有明確指定,則自動添加的Id鍵由Doctrine自動添加。
這應該按預期工作:
columns:
nextfield: string
或:
columns:
id:
type: integer(2)
autoincrement: true
primary: true
nextfield: string
對於整數數據類型,看看這個:http://www.symfony-project.org/doctrine/1_2/en/04-Schema-Files
對於自動增量...
primary: true
autoincrement: true
...應該是你所需要的。