Forked from mecmartini/drupal-entity-query-or-and-reference.php
Created
April 20, 2022 21:42
-
-
Save jcicero518/dba9393d727f925161d8b9411a829d78 to your computer and use it in GitHub Desktop.
Drupal 8 entity query with or condition and entity reference field
This file contains hidden or 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