I am writing some drush scripts and find myself needing to get related entities (nodes) of the current node. However I can only find info for constructing views that do this.
Can anyone tell me is there a programmatic way to pull all entities that relate to the current nid with a filter on the entity type?
Ultimately I need to get a list of node ids that relate to the current node id.
The relationship depend on the relation module.
db_query
(through a script, module or theme) including the reference field and the row result would return theentity_target_id