Doctrine throws an Exception “Couldn’t get last insert identifier.”
Posted: July 10th, 2009 | Author: Marc | Filed under: easier | Tags: Doctrine 1.1, Exception, symfony 1.2, Tips | 2 Comments »If Doctrine throw “Couldn’t get last insert identifier.” exception to your face, you might want to check the schema.yml of your table and change all your:
type: int
to
type: integer
Here is an exemple:
THIS IS BAD:
1 2 3 4 5 6 7 8 | MyModel:
actAs:
Timestampable: ~
columns:
id:
type: int(4)
primary: true
autoincrement: true |
THIS IS GOOD:
1 2 3 4 5 6 7 8 | MyModel:
actAs:
Timestampable: ~
columns:
id:
type: integer(4)
primary: true
autoincrement: true |
This might solve your problem.
Hello,
Thank you! I had exact this Error and now it’s gone…
Keep up your good work…!
Malte
Had the same error. Thanks!