In function FieldCollectionItemEntity::updateHostEntity() this module calls entity_revision_load() immediately followed by entity_extract_ids() with the result of the previous function as a parameter without checking if the entity revision was loaded.

This is throwing a EntityMalformedException within entity_extract_ids().

The reason for this is that taxonomy terms don't support revisions and therefore entity_revision_load() returns false.

A patch to resolve this follows in a second.

Comments

jurgenhaas created an issue. See original summary.

jurgenhaas’s picture

Status: Active » Needs review
StatusFileSize
new716 bytes

Status: Needs review » Needs work

The last submitted patch, 2: field_collection_in-2607226-2.patch, failed testing.

jurgenhaas’s picture

Version: 7.x-1.0-beta10 » 7.x-1.x-dev
Status: Needs work » Needs review

Changing version because the test failures are unrelated to this patch and seem to be fixed in latest dev release.

nachenko’s picture

The patch worked for me on a different issue: Field Collections inside Entity Forms.

Just for the record, I found this patch after reading about this issue on the following article at Acquia website: Issues with field_collection fields in taxonomy terms

daveferrara1’s picture

This is an updated patch if you have trouble with the first call to entity_extract_ids() to obtain the $received_id.

daveferrara1’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta12
daveferrara1’s picture

StatusFileSize
new1.19 KB

Looks like patch 7 did not account for the fact that the $entity->tid and the hostEntityType could be the same. Updated the patch.

daveferrara1’s picture

StatusFileSize
new1.33 KB

Adding another tweak. Solves a case where hostEntityId is false when making a revision. This can be nodes.

so the following never runs.

$current_host = entity_revision_load($this->hostEntityType, $this->hostEntityRevisionId);
list($current_id) = $current_host ? entity_extract_ids($this->hostEntityType, $current_host) : array($recieved_id);
Anonymous’s picture

Here is the patch against the latest dev version.

  • ram4nd committed ad188d7 on 7.x-1.x authored by daveferrara1
    Issue #2607226 by daveferrara1, jurgenhaas, joep.hendrix: Field...
ram4nd’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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