Skip to main content
added 467 characters in body
Source Link
Rotari Radu
  • 259
  • 2
  • 10

You don't have a direct connection for those(the same way some entities work at least) so best approach would be to have a node_update for Color and then inside it to query (can use entityQuery) and see which fruits have that color, from here you can do your stuff.

the following pulled out of my head since I haven't touch D7 for over a year so here we go

function node_update($node){
  if($node['type'] == 'color'){
    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', 'fruit')
    //value or target_id
    ->fieldCondition('field_photo', 'value', $node['nid']); 

    $result = $query->execute();
  }
}

You don't have a direct connection for those(the same way some entities work at least) so best approach would be to have a node_update for Color and then inside it to query (can use entityQuery) and see which fruits have that color, from here you can do your stuff.

You don't have a direct connection for those(the same way some entities work at least) so best approach would be to have a node_update for Color and then inside it to query (can use entityQuery) and see which fruits have that color, from here you can do your stuff.

the following pulled out of my head since I haven't touch D7 for over a year so here we go

function node_update($node){
  if($node['type'] == 'color'){
    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', 'fruit')
    //value or target_id
    ->fieldCondition('field_photo', 'value', $node['nid']); 

    $result = $query->execute();
  }
}
Source Link
Rotari Radu
  • 259
  • 2
  • 10

You don't have a direct connection for those(the same way some entities work at least) so best approach would be to have a node_update for Color and then inside it to query (can use entityQuery) and see which fruits have that color, from here you can do your stuff.