When I attempt to delete a node with a field collection, I get the following error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails ("my_database"."field_collection_item_revision", CONSTRAINT "versioned_field_collection_item" FOREIGN KEY ("item_id") REFERENCES "field_collection_item" ("item_id")): DELETE FROM {field_collection_item} WHERE (item_id IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] => 1229 ) in EntityAPIController->delete() (line 386 of /www/mysite/sites/all/modules/entity/includes/entity.controller.inc).

My team and I have used field collections successfully before, but for some reason, we're now getting this issue. Any assistance in this would be appreciated.

Thanks,
Sean

Comments

shendric’s picture

My team may have found a solution for this, by making changes to the Entity API, as it appears that the Entity CRUD controller was trying to remove a base table for a field collection before removing the revision, and failing. (https://drupal.org/node/2067179). Sorry for any cross-posting, but we weren't sure which module was most appropriate to address.

jmuzz’s picture

Priority: Critical » Normal
Issue summary: View changes