orm – Doctrine问题:无法获取最后一个插入标识符

当我尝试将数据保存到我的模型时,Doctrine会抛出此异常:
Message: Couldn't get last insert identifier.

我的表设置代码是:

$this->hasColumn('id','integer',4,array(
         'type' => 'integer','length' => 4,'fixed' => false,'unsigned' => false,'primary' => true,'autoincrement' => true,));

请帮忙.谢谢.

解决方法

检查以确保数据库中的列设置为auto_increment.看起来Doctrine类将它作为auto_increment处理,但它不是在DB中设置的.

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...