Skip to main content
2 of 2
removed "Drupal" from the title; removed tags from the title
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Get pure SQL from Drupal::entityQuery

Given the following code, how can I print the SQL that is generated?

$bundle='my_bundle_type';
$query = \Drupal::entityQuery('node');
$query->condition('status', 1);
$query->condition('type', $bundle);
$entity_ids = $query->execute();

What I have tried:

  • __toString() doesn't work
  • dpq($query) throws an error
Oleg Videnov
  • 1.8k
  • 2
  • 15
  • 26