Hi,
In my setup I'm using both field_sql_storage and mongodb_field_storage fields. I ran again into the 'No entity_type' exception thrown by mongodb field storage module, so I had to do some digging.
So in my case the problem is that if I have an entity like for example commerce_coupon, it's fields are not found with EntityFieldQuery. Mongodb grabs the query in mongodb_entity_query_alter and field sql query is not executed. I don't understand how I didn't run into this earlier.
My question is, does this make sense:
/**
* Implements hook_entity_query_alter().
*/
function mongodb_field_storage_entity_query_alter($query) {
if(!empty($query->fieldConditions[0]['field']['storage']['type']) && $query->fieldConditions[0]['field']['storage']['type'] == 'mongodb_field_storage')
$query->executeCallback = 'mongodb_field_storage_query';
}
in mongodb_field_storage.module
Works for me, but could there be some side effects?
EDIT: The version I'm using is actually not the latest dev version so I haven't tested how http://drupal.org/node/839264 effected
Comment | File | Size | Author |
---|---|---|---|
#2 | 1612374.patch | 693 bytes | chx |
Comments
Comment #1
lurkingbeast CreditAttribution: lurkingbeast commentedActually I have noticed it before, deleted fields and instances in mysql field_config and field_config_tables never actually got deleted before. Now they do, hooray! :)
Comment #2
chx CreditAttribution: chx commentedPlease test on both mongo and sql fields.
Comment #3
mgiffordIs this related in any way to:
https://drupal.org/project/efq_views
Comment #4
chx CreditAttribution: chx commentedNo.
Comment #5
michaellander CreditAttribution: michaellander commentedChx, we had the same exact issue, and found the same solution as your patch. The patch appears to be working for us.
Thanks!
Comment #6
mgiffordCan this patch be brought into the next release?
Comment #7
chx CreditAttribution: chx commentedSo far there was only one "yes" so I am a bit hesitant.
Comment #7.0
chx CreditAttribution: chx commentedEDIT
Comment #8
Island Usurper CreditAttribution: Island Usurper commentedI'll give a +1 to this patch. It's necessary if you're trying to switch to MongoDB, but some module is using EntityFieldQuery on an entity type that doesn't have fields. mongodb_migrate doesn't do anything for those. Of course, that use of EFQ might be a bug—or at least silly—but there's nothing else saying they can't do it, either.