3

I need to query an article with more than 1 tag (a field entity reference) in drupal entity query.

I tried this :

$query = Drupal::entityQuery('node')
                ->condition('type', 'article')
                ->condition('field_tags', 1, '>');
dd($query->execute());

But I got more than expected the articles id's and I don't why.

What is the good query to do that ?

1 Answer 1

4

Try to use the delta. This is explained here: QueryInterface:

$query = Drupal::entityQuery('node')
            ->condition('type', 'article')
            ->condition('field_tags.%delta', 1, '>');
dd($query->execute());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.