I have the following query which works:
$query = "SELECT field_code_description_value FROM {field_data_field_code_description} WHERE bundle = :vocabulary AND entity_id in (SELECT entity_id FROM {taxonomy_term_data} WHERE name = :name)"; $results = db_query($query, array(':name' => $fund_code, ':vocabulary'=>'fund_code')); $terms = $results->fetchObject();
I'm trying to convert this into using EntityFieldQuery, as it seems to be the best way to go (and I need some practice), but I couldn't get it right. This is what I tried:
$query = new EntityFieldQuery(); $query ->entityCondition('entity_type','taxonomy_term') ->entityCondition('bundle','fund_code') ->fieldCondition('taxonomy_term_data','field_code_description', $fund_code, '=') //->propertyCondition('vid', $fundCodeTaxonomy->vid); $results = $query->execute(); foreach($results['taxonomy_term'] as $tid) { $term = taxonomy_term_load($tid); dpm($term); }
How do I properly use EntityFieldQuery here?