.. which leads to a the following error when editing a translation of that node:

EntityMalformedException: Missing bundle property on entity of type field_collection_item. in entity_extract_ids() (line 7389 of /home/diederik/Openbaar/vanilla/includes/common.inc).

After deletion, the collection field of the still existing translations of that node hold a reference to that entity, but the entity has been deleted.

I attached an image of the (selenium) test case I use. The node type in the test is "Translatable with collection" (with translation, require language). The included collection has one textfield: twc-coll-textfield. Modules I enabled for the test are: i18n_node, field_collection.

CommentFileSizeAuthor
#1 deleting-a-translated-node-with-a-collection-also-deletes-collection-entity-1315432-1.patch1.61 KBzilverdistel
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch deleting-a-translated-node-with-a-collection-also-deletes-collection-entity-1315432-1.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots. View
Selenium test case65.76 KBzilverdistel
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

zilverdistel’s picture

Status: Active » Needs review
FileSize
1.61 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch deleting-a-translated-node-with-a-collection-also-deletes-collection-entity-1315432-1.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots. View

Attached is a patch that solves this by checking if other host entities still use the field-collection entity. If it is still in use, the field collection entity won't be deleted.

Daniel Wentsch’s picture

Thanks a lot, patch works perfectly!

zilverdistel’s picture

Status: Needs review » Reviewed & tested by the community
tim.plunkett’s picture

Status: Reviewed & tested by the community » Needs review

Can't RTBC your own patch. Let's get another review here.
Also, your patch introduces some trailing whitespace, can you reroll it?

mariancalinro’s picture

Status: Needs review » Reviewed & tested by the community

Hi guys, I have this patch applied on one live website (for about a week and a half), and it's working fine. I did test it on my local environment, the client tested it on the staging environment, so I guess it's RTBC.

tim.plunkett’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!
I went with key() instead of array_shift(array_keys());

http://drupalcode.org/project/field_collection.git/commit/ff45e3d

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.