If a field collection item is deleted, any entities that reference that field collection will get a fatal error when an admin edits that entity when using the embedded field collection form:
EntityMalformedException: Missing bundle property on entity of type field_collection_item. in entity_extract_ids() (line 7410 of /shared/vash/sandboxes/reid/pin/www/includes/common.inc).
This is because field_collection_field_widget_form() does not validate that $field_collection_item is an empty variable before passing it into field_attach_form(). A simple check could prevent this error from happening and allow the references to be removed.
Related issues:
#1186826: Delete orphaned field_collection_item entities when they are (programatically) removed from the host entity
#1331764: Delete host entity reference when a field_collection_item entity is deleted programatically
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1399746-field-collection-field-attach-form-fatal.patch | 822 bytes | dave reid |
| #1 | 1399746-field-collection-field-attach-form-fatal.patch | 869 bytes | dave reid |
Comments
Comment #1
dave reidComment #2
dave reidActually hold off on this. It doesn't quite allow the node to be saved.
Comment #3
dave reidThis is actually the proper fix.
Comment #4
tim.plunkettCommitted, thanks!
http://drupalcode.org/project/field_collection.git/commit/2231ecc
Comment #5
thomas_rendleman commentedDavid Reid. Thank you. I spent hours and two days trying to figure this one out. I am doing some HUGE queries. I even went from php 400M to 800M. Nothing worked until I read your post. Thank you again. Now I can get back to work...