I am getting an empty array when I query by the value of a referenced field.
I have the following:
$result = \Drupal::entityQuery('node')
->condition('type', 'custom')
->condition('status', 1)
->condition('field_category.entity:taxonomy_term.name', 'somevalue', '=')
// ->condition('field_category.%delta', 'somevalue');
->execute();
Using ->condition('field_category.%delta', 'somevalue');
returns way too many results (nids) than expected.
using ->condition('field_category.entity:taxonomy_term', 'somevalue', '=')
: returns an empty array.
Am I using an incorrect syntax to query by a related field?