I have noticed that EFQ, which should return field collection item's parent entity, fails on my setup.
What I have is a field collection that can be assigned to either a node or a custom entity and I'm also using mongodb as backend.
The code is in protected function fetchHostDetails():
$query = new EntityFieldQuery();
$query->fieldCondition($this->fieldInfo(), 'revision_id', $this->revision_id);
The mongo query for this is:
db.fields_current.field_collection_item.find({revision_id: 8016363});
And that of course fails because for nodes the correct query is:
db.fields_current.node.find({revision_id: 8016363});
This can be achieved with:
$query = new EntityFieldQuery();
$query->fieldCondition($this->fieldInfo(), 'revision_id', $this->revision_id);
$query->entityCondition('entity_type', 'node');
This translates to:
db.fields_current.node.find({revision_id: 8016363});
Then it works with nodes, but not with my custom entity.
I think this is broken only when using mongodb. Has anybody else experinced the same problem?
I created a patch for this.
Comment | File | Size | Author |
---|---|---|---|
#1 | field_collection-efq_host_entity-2134853-1.patch | 1.43 KB | attekilpela |
Comments
Comment #1
attekilpela CreditAttribution: attekilpela commentedComment #2
attekilpela CreditAttribution: attekilpela commentedComment #3
k_zoltan CreditAttribution: k_zoltan commentedComment #4
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 5 year old patch in #1 to field_collection.module b/field_collection.module does not apply to the latest field_collection 7.x-1.x-dev and if still relevant needs a reroll.