This doesn't work:
$query = \Drupal::entityQuery('group') ->condition('field_parent_site', $group->id()); $gids = $query->execute();
$connection = \Drupal::database(); $query = $connection->select('group__field_parent_site', 'p'); $query->fields('p', ['entity_id']); $query->condition('p.field_parent_site_target_id', $group->id()); $result = $query->execute();
I even tried resetting cache programmatically but that too had no effect. I don't have any problem with it while testing it through browser.