views and contextual filter with entity reference to current user I have a view that I need to filter based on the current logged in user, however a secondary entity reference is in-between the two.  Pretty sure I need to add in PHP contextual filter code but not exactly sure what is needed.

Scenario:


inventory has an entity reference to retail_location.  
retail_location has an entity reference to users.  
I need to display inventory based on the retail_location of the logged in user.


D7.
Was able to get it working using the following code, it does however only allow for one retail location, which is all I need for this scenario.

  global $user;
  $query = new EntityFieldQuery;
  $query-&gt;entityCondition('entity_type', 'node')
      -&gt;entityCondition('bundle', 'rnm_principal')
      -&gt;fieldCondition('field_principal_retailer', 'target_id', array($user-&gt;uid));
  $results = $query-&gt;execute();
  return current($results['node'])-&gt;nid;