Cleanest way to write EntityCondition on field from widget The widget is nodehierarchy_menu_links - it has a structure embedded in the node like: 

[0]
-&gt; [module]
-&gt; [menu_name]
...
-&gt; [pnid]


It has more than one value as per the widget system. I have a partial entity query, but want to filter on [pnid] i.e. show me all the nodes owned by uid and belonging to a particular parent. Is there an elegant to filter on these sub-items using the basic EntityFieldQuery?
I was trying to find a way to filter on complex parts of the node - ie widget items that were attached as properties. 

I didn't find a way. Resolved with just SelectQuery. I manually did the join instead of using node semantics and related node hooks. It would be nice to have findNodeByPnid... - and I can't see a way to build a condition without having to go another layer down into the node and working out how it is built.

Lots of our code has various forms of 'find where parent is' and 'show me the parent of this node' - subtly different enough to make it hard to generalise. Therefore, the code is broken up into parts. 

1 initiate query

Always adding tag.

$query_key = 'associatenode_' . implode('', $node_types);
$query = db_select('node', 'n');
$query-&gt;fields('n', array('nid', 'title'))
      -&gt;condition('n.type', $node_types, 'IN')
      -&gt;orderBy('title', 'ASC')
      -&gt;addTag($query_key);


2 Add join

Either calling join function directly or by tag. Further mangle query later. 

function hottopicsresearch_query_associatenode_hot_topic_research_alter(QueryAlterableInterface $query) {


Calls

function hottopicsresearch_research_for_topic_query_join($parent_nid, QueryAlterableInterface $query) {
  // Find our menu links
  $query-&gt;leftJoin('nodehierarchy_menu_links', 'nh', 'n.nid = nh.nid');

  // Find associated menus. This is used to find the parent menus.
  $query-&gt;leftJoin('menu_links', 'menu', 'nh.mlid = menu.mlid');

  // Now find the parent menu
  $query-&gt;leftJoin('nodehierarchy_menu_links', 'nh_parent', 'menu.plid = nh_parent.mlid');

  // Grab the actual parent nodes
  $query-&gt;leftJoin('node', 'node_parent', 'nh_parent.nid = node_parent.nid');

  // Filter out anything that is not our parent
  $query-&gt;condition('nh_parent.nid', $parent_nid, '=');
}