Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jcicero518/dba9393d727f925161d8b9411a829d78 to your computer and use it in GitHub Desktop.

Select an option

Save jcicero518/dba9393d727f925161d8b9411a829d78 to your computer and use it in GitHub Desktop.
Drupal 8 entity query with or condition and entity reference field
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
$orGroup = \Drupal::entityQuery('node')->orConditionGroup()
->condition('type', 'page');
->condition('type', 'article')
->condition('type', 'landing');
$result = \Drupal::entityQuery('node')
->status(1)
->condition($orGroup)
->condition('comment:status', CommentItemInterface::OPEN)
->execute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment