Problem/Motivation
When one uses the "Set a Workflow state (with a comment)" action in rules in combination with the "After saving a new [ECK Entity]" event, it causes the site to bring up an error page using the maintenance mode template.
The error log then reports:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '16' for key 'PRIMARY': INSERT INTO {eck_my_entity} (id, type, uid, created, changed) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 16 [:db_insert_placeholder_1] => my_entity [:db_insert_placeholder_2] => 927 [:db_insert_placeholder_3] => 1423764890 [:db_insert_placeholder_4] => 1423764890 ) in drupal_write_record() (line 7239 of /home/public_html/includes/common.inc).
Workaround
If you use the "Save entity" action with the "Force saving immediately" option selected before the "Set a Workflow state (with a comment)" SQL will not crash and the action will successfully set the Workflow state. It will however, not set a comment I am uncertain if this particular problem is related to this crash.
Comments
Comment #1
Amad Tababa CreditAttribution: Amad Tababa commentedThanks Worked for me :)
Comment #2
johnvThis should now be fixed with the solution in #2600934.