Im writing a functional javascript test for my project where im facing a problem with my feature. I have created a group entity just above it and referencing a parent group.
This doesn't work:
$query = \Drupal::entityQuery('group')
->condition('field_parent_site', $group->id());
$gids = $query->execute();
This works:
$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.