Closed (fixed)
Project:
Corresponding Entity References
Version:
7.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 Jul 2014 at 17:44 UTC
Updated:
9 Jul 2015 at 12:56 UTC
Jump to comment: Most recent
Comments
Comment #1
nancydruIn cer_get_field_collection_lineage_array(),
$collection->hostEntityType()is returning nothing. You can duke it out with Field Collection as to who has the bug.cer 7.x-3.0-alpha5
field_collection 7.x-1.0-beta7
entity 7.x-1.5
Drupal 7.30 (also on 7.28)
Comment #2
nancydruThis seems to avoid the problem for me.
Comment #3
nancydruThis is driving my users crazy. Have you got any ideas?
Comment #4
phenaproximaLooking at Field Collection's code, it appears that $collection->hostEntityType() will return NULL if the host entity's ID cannot be loaded by $collection->fetchHostDetails(). There seem to be a few reasons why that could happen, but the bottom line is that I don't think this is a bug in CER (or even necessarily in Field Collection). It may be site-specific, but without knowing more about your configuration I cannot say for sure.
One option is for you to override cer_get_field_collection_lineage_array() with your version from #2. You can do that by implementing hook_entity_property_info_alter() and modifying the getter callback for the lineage property (part of the cer struct) that CER exposes on field collection items. Does that make sense?
Hope this helps.
Comment #5
nancydruYes and no. I'm not doing anything super-fancy, so I am confused as to why this is failing.
Comment #6
phenaproximaIs there any chance I could poke around on your dev site (assuming this is happening there too)?
Comment #7
nancydruAlso see #2249067: Undefined index: entity keys in entity_extract_ids() on node_save()
Comment #8
nancydruOkay, back to this. Unfortunately, the dev site is behind a company firewall.
The node I am looking at has TWO field collections. In
cer_get_field_collection_lineage_array()I stuck adpm($collection, 'collection', 'error')right after the first line ($collection = $data[1];) and I see it displayed THREE times. The first two have valid HostEntity stuff, but the third one is empty.The node does display an "Add Another" button, but there is not an extra one present. And when I build the node, I am adding only two field_collections.
Comment #9
recrit commentedPotential fix at #2458891: Host entity should be updated for revision changes. This issue and patch addresses the general issue of any module implementing hooks during the field collection update save.
Comment #10
amir simantov commentedCross referencing with a similar issue: #2249067: Undefined index: entity keys in entity_extract_ids() on node_save()
If duplicated, one of them should be closed.
Comment #11
amir simantov commentedI have tested the patch from field_collection: #2458891: Host entity should be updated for revision changes
It seems to eliminate the error for me.
I leave it to the maintainer to decide whether to close it.
Comment #12
nancydruI opened it, so I'm marking it duplicate.
Comment #13
BarisW commentedCan this be re-opened? I updated field_collection, which includes #2458891: Host entity should be updated for revision changes.
I'm still getting the following error:
I'm using Field Collection and Corresponding Entity References.
Comment #14
BarisW commentedComment #15
phenaproxima@BarisW, did you update to the latest *dev* of Field Collection? AFAIK that patch is not in the stable release yet.
Comment #16
BarisW commented@phenaproxima; sigh. You were right. Updating to dev fixes the issue. Thanks!
Comment #17
miroslavbanov commentedNotice: Undefined index: entity keys in entity_extract_ids()I am still getting the error, with the latest version of field_collection module. I use workbench_moderation and other modules that add to the complexity, and may be related.
Patch #2458891-1: Host entity should be updated for revision changes makes it so the entity is returned, but the entity type is not.
In my case $data[0] should be "node", but it is empty instead.
Comment #18
phenaproximaAre you using the dev version of field_collection? I'm not certain, but I don't think that patch has been merged into the stable release.
Comment #19
miroslavbanov commentedI am using latest 7.x-1.x
Comment #20
miroslavbanov commentedOK, this seems to be reproducible without CER (only field_collection), and seems to be related to Workbench moderation. Happens specifically when updating a revision-moderation-enabled content, that is published, and a new revision exists, and the revision is being updated, but it is still kept as Draft.
I am using 7.x-1.x version of Workbench moderation.
Closing task again as problem is not with CER.
Comment #21
phenaproxima