我使用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
...应该是你所需要的。