I am retrieving a tid of a taxonomy term by using EntityFieldQuery
. However, I need to cross-link the taxonomy_term_hierarchy table to list those terms which have a particular parent, but I am not able to get it. In the code below
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'taxonomy_term')
->propertyCondition('vid', $vocabulary)
->propertyCondition('name', $termino)
->propertyCondition('parent', $parent_id)
the last line is throwing the following (expected) error. The same code, without the last property condition, works correctly. How can I achieve the result?
The returned error is:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'taxonomy_term_data.parent' in 'where clause'
$query->condition('parent.target_id', $parent_id);
or if you want to query entities referencing taxonomy terms by a given parent id$query->condition('field_term_reference.entity.parent.target_id', $parent_id);