Getting all nodes that have a specific term id using EntityFieldQuery I have been using the following line to get all the nodes with a term id

taxonomy_select_nodes($tid);


But now I want to sort the output by weight (field_audio_weight - field I created).
How can I achieve the same output using EntityFieldQuery ?
Something like:

$query = new EntityFieldQuery()
  -&gt;entityCondition('entity_type', 'node')
  -&gt;fieldCondition('field_taxonomy_reference', 'tid', TERM_ID)
  -&gt;fieldOrderBy('field_audio_weight', 'value', 'DESC');

$results = $query-&gt;execute();


Check these articles for more information:

https://www.phase2technology.com/blog/entityfieldquery-let-drupal-do-the-heavy-lifting-pt-1/

https://www.phase2technology.com/blog/entityfieldquery-let-drupal-do-the-heavy-lifting-pt-2/