Working in symfony 1.4, with Propel for my ORM (not sure how to find the version of Propel).
In a unit test of an object with a unique constraint in the database, I test for the exception being caught:
try {
$room1a->save();
// Shouldn't have saved, so shouldn't have an id
$t->ok(!$room1a->getId(), "Failed to save duplicate room");
} catch (Exception $e) {
$t->ok($e, "Threw exception on creating duplicate room");
}
but if I then correct the duplication and try again, thus
$room1a->setCode('1a');
$room1a->save();
$t->ok($room1a->getId()), "Saved this time");
I get "Unable to get sequence id":
PropelException: Unable to get sequence id. [wrapped:
SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current
transaction is aborted, commands ignored until end of transaction
block]
(in
lib/vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel/util/BasePeer.php
on line 264)
I've tried recreating the object (i.e. a new Room object) and saving it, with the same result; it appears that there is a state in the connection (?) which needs resetting.
The only way round I've found is to roll back the transaction and begin a new one.