WebTechKitchen; Your Web Technology Kitchen, contact us to create, or maintain your websites and other digital properties.

Using entityQuery in a drush command

Submitted by barnettech on Tue, 04/20/2021 - 10:20
      $result = \Drupal::entityQuery('group')
        ->condition('type', $type)
        ->range(0, 20000)
        ->accessCheck(FALSE)
        ->execute();

make sure to set accessCheck to FALSE or you'll get no results, entityQuery respects permissions and the drush user won't be running as any particular user.