ORM – doctrine problem: unable to get the last insert identifier

When I try to save data to my model, doctrine throws this exception:

Message: Couldn't get last insert identifier.

My table setup code is:

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

Please help. thank you.

Solution

Check to ensure that the column in the database is set to auto_ increment. It looks like the doctrine class treats it as auto_ Increment processing, but it is not set in dB

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>