Created
November 5, 2020 15:24
-
-
Save mecmartini/d932814b0e37a163977342a068ff6314 to your computer and use it in GitHub Desktop.
Drupal 8 entity query with or condition and entity reference field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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