How to debug an entity query using addTag and a hook_query_alter.

Public

Get raw version
php
  1. <?php
  2.  
  3.  
  4. $query->entityCondition('entity_type', 'node')
  5. ->entityCondition('bundle', 'article')
  6. ->propertyCondition('status', 1)
  7. ->addTag('debug');
  8.  
  9. // Add this function to the module
  10. function mymodule_query_alter($query) {
  11. if ($query->hasTag('debug')) {
  12. dpq($query);
  13. }
  14. }