Skip to content

Instantly share code, notes, and snippets.

@mstekl
Created October 21, 2020 21:38
Show Gist options
  • Save mstekl/2a32effc368d69f3901b3ceb524ecfbc to your computer and use it in GitHub Desktop.
Save mstekl/2a32effc368d69f3901b3ceb524ecfbc to your computer and use it in GitHub Desktop.
Drupal 8 query users with boolean field != true and a specific role
$query = \Drupal::entityQuery('user')
->condition('roles', 'myRole', 'CONTAINS');
$group = $query->orConditionGroup()
->notExists('field_processed')
->condition('field_processed', 1, '<>');
$ids = $query->condition($group)->execute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment